Question
Database queries: This part of the Assignment requires you to provide SELECT queries for the questions. Your queries will be run against the Sakila database.
Database queries:
This part of the Assignment requires you to provide SELECT queries for the questions.
Your queries will be run against the Sakila database. The relevant schema is provided below:
Provide the answers to the steps below:
Step 1:
Find all films with maximum length or minimum rental duration (compared to all other films).
In other words let L be the maximum film length, and let R be the minimum rental duration in the table film. You need to find all films that have length L or duration R or both length L and duration R.
If a film has either a maximum length OR a minimal rental duration it should appear in the result set. It does not need to have both the maximum length and the minimum duration.
You just need to return the film_id for this query.
Step 2:
We want to find out how many of each category of film ED CHASE has starred in.
So return a table with category_name and the count of the number_of_films that ED was in that category.
Your query should return every category even if ED has been in no films in that category
Order by the category name in ascending order.
Step 3:
Find the first_name, last_name and total_combined_film_length of Sci-Fi films for every actor.
That is the result should list the names of all of the actors(even if an actor has not been in any Sci-Fi films) and the total length of Sci-Fi films they have been in.
Look at the category table to figure out how to filter data for Sci-Fi films.
Step 4:
Find the first_name and last_name of all actors who have never been in
a Sci-Fi film.
Step 5
Find the film_title of all films which feature both KIRSTEN PALTROW and WARREN NOLTE
Order the results by film_title in descending order.
Warning: this is a tricky one and while the syntax is all things you know, you have to think a bit oustide the box to figure out how to get a table that shows pairs of actors in movies.
film film id title description release_year anguage_id original_languagei rental_duration rental rate ength replacement_cost category category id name language language_id film category film id actor last update name last update category idlast update actor_id first _name last name last update film_id actor_id last updateStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started