Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

6. Using the Rental table, select all rentals that occurred before 08-01-2005. L

ID: 3605350 • Letter: 6

Question

6. Using the Rental table, select all rentals that occurred before 08-01-2005. List Rental_Date, Inventory_ID, Customer_ID and Staff_ID. Order by Customer_ID then by Rental_Date.

7. Using the Customer and the Address table (you will need to Join the tables), list the customer_id, first_name, last_name, address, district, city_id, postal_code, phone, and email. Join on the address_id from both tables. Order by last_name then first_name.

8. Using the Customer and the Address table (you will need to Join the tables), list the customer_id, first_name, last_name, address, district, city_id, postal_code, phone, and email for those customers that live in California. Join on the address_id from both tables. Order by last_name then first_name.

9. Using the Customer and the Address table (you will need to Join the tables), list the customer_id, first_name, last_name, address, district, city_id, postal_code, phone, and email where the city_id is greater than 500. Join on the address_id from both tables. Order by city_id.

10. Using the actor and film_actor table, join using the actor_id field from both tables. List the actor_id, first_name, last_name, and film_id. Order by film_id, actor_id

Explanation / Answer

Ans 6)

select Rental_Date, Inventory_ID, Customer_ID ,Staff_ID
from Rental
where Rental_Date<'08-01-2005'
Order by Customer_ID , by Rental_Date;

Ans 7)

select customer_id, first_name, last_name, address, district, city_id, postal_code, phone, email
from Customer join Address
on (Customer.address_id=Address.address_id)
Order by last_name , first_name;

Ans 8)

select customer_id, first_name, last_name, address, district, city_id, postal_code, phone, email
from Customer join Address
on (Customer.address_id=Address.address_id)
where Address='California'
Order by last_name , first_name;

Ans 9)

select customer_id, first_name, last_name, address, district, city_id, postal_code, phone, email
from Customer join Address
on (Customer.address_id=Address.address_id)
where city_id>500
Order by city_id;