This is using the Sakila Sample database and tables which can download here: htt
ID: 3932644 • Letter: T
Question
This is using the Sakila Sample database and tables which can download here:
https://dev.mysql.com/doc/sakila/en
Write a query that produces the last name and first name and film title of all actors who are in Family, Foreign, or Horror films ordered by last name. Next, Write a query that produces the last name and first name and film title and film category of every actor who is in both a Family move and a Horror movie ordered by last name. rename the category from “name” to “category” in your result table. (hint: “AS” keyword)
**Note that you will be performing a query on multiple tables**
Explanation / Answer
1.
Select actor.last_name,actor.first_name,film.title from actor inner join film_actor on actor.actor_id = film_actor.actor_id inner join film on film_actor.film_id = film.film_id inner join film_category on film_category.film_id = film.film_id inner join category on category.category_id = film _category.category_id where category.name ='Family' or category.name = 'Foreign' or category.name = 'Horror' order by actor.last_name;
2.
Select actor.last_name,actor.first_name,film.title ,category.name AS category from actor inner join film_actor on actor.actor_id = film_actor.actor_id inner join film on film_actor.film_id = film.film_id inner join film_category on film_category.film_id = film.film_id inner join category on category.category_id = film _category.category_id where category.name ='Family' and category.name = 'Horror' order by actor.last_name;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.