This repository contains the solutions to the practice question on sakila database. The questions are divided into 3 levels: Beginner, Intermediate, Advanced and Expert. The questions are listed below.
-
Retrieve all columns from the
customer
table. -
List the first and last names of customers in the
customer
table. -
Show all the distinct cities in the
city
table. -
Display all the film titles from the
film
table. -
List the titles of films along with their release years.
-
Retrieve the names and emails of active customers.
-
Get the total number of films available in the inventory.
-
Show the rental rate and rental duration for films.
-
Display all the categories of films.
-
List the names, emails and phone numbers of customers.
-
Retrieve the titles of films that are available for rent.
-
List the names of all employees.
-
Show the number of films in each category.
-
Get the rental rates of films with a rating of 'PG'.
-
List all the staff members.
-
Display the rental duration and rental rate for films in a specific category.
-
List the names and emails of customers who have rented films.
-
Show the cities in which customers live.
-
List the titles of films released in a specific year.
-
Retrieve the staff members and their contact details.
-
Show the films that are not available for rent.
-
List the top 10 customers who have spent the most.
-
Get the names of actors who have appeared in more than 30 films.
-
List the rental dates for a specific customer.
-
Show the films that have a replacement cost of $20.
-
Retrieve the names of customers who have rented more than 5 films.
-
List the film titles and their respective language names.
-
Show the films that are not in stock.
-
List the actors who have appeared in the same film.
-
Retrieve the names of customers who live in the same city as a specific customer.
-
Show the total revenue generated from each film.
-
Get the films that have a replacement cost greater than the average replacement cost.
-
List the customers who have rented the same film.
-
Show the staff members and their total sales.
-
List the top 5 films with the highest total rental revenue.
-
Retrieve the customers who have rented more than one film on the same day.
-
Display the average rental duration for each rating category.
-
List the actors who have appeared in the most rented films.
-
Show the customers who have rented the most films in each category.
-
Retrieve the films that were rented more than 10 times in the last month.
-
List the staff members and the number of rentals they have handled.
-
Show the films that were rented by customers living in a specific city.
-
Retrieve the films that have not been rented yet.
-
List the actors who have appeared in films with the same rating.
-
Show the total rental revenue for each customer.
-
List the customers who have rented all the films in a specific category.
-
Retrieve the films with the highest total rental revenue.
-
Display the number of rentals for each actor.
-
List the staff members who have handled rentals on a specific date.
-
Show the customers who have rented the most films in a month.
-
Retrieve the films that are available for rent and have not been rented yet.
-
List the customers who have rented the same film multiple times.
-
Show the films that have been rented at least once on each day of the week.
-
Retrieve the actor who has appeared in the most diverse categories of films.
-
List the customers who have rented films with the same rating as a specific film.
-
Show the top 5 actors with the highest total rental revenue.
-
Retrieve the films with the highest rental duration in each category.
-
List the top 10 customers who have rented the most diverse films.
-
Display the average rental revenue for each day of the week.
-
Show the actors who have appeared in films with the same language as a specific film.
-
Retrieve the film titles and the names of the actors who have appeared in them.
-
List the films that are only available for rent in a specific store.
-
Show the total rental revenue for each category.
-
Retrieve the top 5 customers who have spent the most on rentals.
-
List the customers who have rented the same set of films as another customer.
-
Display the actors who have appeared in films with the same director.
-
Show the total rental revenue for each actor.
-
Retrieve the customers who have rented a film from every category.
-
List the films that have the same rental duration and rental rate as a specific film.
-
Show the customers who have not rented any films.
-
Retrieve the actors who have appeared in more films than any other actor from the same country.
-
List the films that are frequently rented together (in the same rental).
-
Show the customers who have rented a film that another customer is currently renting.
-
Display the actors who have appeared in films with the same actor as themselves.
-
Retrieve the films that have been rented the most times on a single day.
-
List the films that have never been rented.
-
Show the customers who have rented the most films in a single day.
-
Retrieve the actors who have appeared in films with the same title.
-
List the films that have not been rented in the last 30 days.
-
Show the customers who have rented a film that another customer is currently renting and are from the same city.
-
Retrieve the actors who have appeared in films that have the same keyword in their descriptions.
-
List the films that have been rented the most times in a single month.
-
Show the customers who have not rented any films in the last 30 days.
-
Display the actors who have appeared in the most expensive films.
-
Retrieve the films that have been rented by the same customer on the same day.
-
List the films that have been rented by a specific customer on the same day as a given film.
-
Show the actors who have appeared in films with the same title and have worked with the same director.
-
Retrieve the films that have been rented by a customer living in the same city as a specific customer.
-
List the films that have been rented by a specific customer and are currently rented by other customers.
-
Show the actors who have appeared in films that have been rented by the same customer on the same day.
-
Retrieve the actors who have appeared in films that have been rented by the same customer in the same month.
-
List the films that have been rented by a customer who has also rented a given film.
-
Show the actors who have appeared in films that have been rented by the same customer in the same month and have worked with the same director.
-
Retrieve the actors who have appeared in films that have been rented by the same customer on the same day and are from the same city.
-
List the films that have been rented by a customer who has also rented a given film and is from the same city.
-
Retrieve the top 5 customers who have rented films in all available categories.
-
List the actors who have appeared in films of all the languages available in the database.
-
Show the 10 most rented film pairs (combinations of two films) in terms of frequency.
-
Retrieve the customers who have rented at least one film from each actor's filmography (consider all actors).
-
List the top 5 staff members with the highest total sales, taking into account rental and late fees.
-
Display the customers who have rented the same set of films (title and description) as another customer in the same month.
-
Retrieve the films with the highest total rental revenue for each store location.
-
Show the actors who have appeared in films directed by the same director multiple times.
-
List the customers who have rented the same set of films (title and category) as another customer on the same day.
-
Display the average rental duration for films with a distinct combination of rental rates and replacement costs.
-
Retrieve the customers who have rented all films directed by a specific director.
-
List the actors who have appeared in films that have not been rented in the last 30 days.
-
Show the films that have been rented on the same day by the same customer in more than one store.
-
Retrieve the staff members who have handled rentals for all film categories.
-
Display the actors who have appeared in films that are currently available for rent in all stores.
-
List the customers who have rented the same film on the same day in different months.
-
Show the top 5 customers with the highest average rental revenue per month.
-
Retrieve the films with the highest total rental revenue for each film category.
-
List the staff members who have the same number of rentals as another staff member on a specific date.
-
Display the customers who have rented films with the same keyword in their descriptions, with the same language as another customer.
-
Retrieve the actors who have appeared in films that have been rented on the same day by the same customer and have the same language.
-
Show the films that have been rented by a customer who has also rented a film from the same category on the same day.
-
List the customers who have rented the same set of films as another customer in the same year.
-
Retrieve the staff members who have handled rentals for films with the same rating as another staff member on the same day.
-
Display the customers who have rented films with the same title as another customer on the same day.
-
Retrieve the actors who have appeared in films directed by the same director and have the same rating as another film they've appeared in.
-
List the films that have been rented in all store locations.
-
Show the customers who have rented films that have not been rented by any other customer in the same category.
-
Retrieve the staff members who have handled rentals for the same customer on the same day in different years.
-
Display the actors who have appeared in films with the same title, description, and release year.
-
List the customers who have rented the same set of films as another customer in the same category and language.
-
Retrieve the actors who have appeared in films directed by the same director and have the same rating as another film they've appeared in, and are from the same country.
-
Show the films that have been rented by a customer who has also rented a film from the same category, with the same rating and rental rate, on the same day.
-
Retrieve the staff members who have handled rentals for the same customer on the same day, with the same rental rate.
-
List the customers who have rented films that have not been rented by any other customer in the same category, language, and description.
-
Display the actors who have appeared in films with the same title, description, release year, and rating.
-
Retrieve the films that have been rented in all store locations, with the same rental rate and rental duration.
-
Show the customers who have rented films that have not been rented by any other customer in the same category, language, description, and rental rate.
-
List the staff members who have handled rentals for the same customer on the same day, with the same rental rate and late fees.
-
Retrieve the actors who have appeared in films directed by the same director and have the same rating as another film they've appeared in, from the same country, and have worked with the same actor.
-
Show the films that have been rented by a customer who has also rented a film from the same category, with the same rating, rental rate, rental duration, and release year, on the same day.
-
List the customers who have rented the same set of films as another customer in the same category, language, description, rental rate, and rental duration.
-
Retrieve the staff members who have handled rentals for the same customer on the same day, with the same rental rate, late fees, and rental duration.
-
Display the actors who have appeared in films with the same title, description, release year, rating, and language.
-
Retrieve the films that have been rented in all store locations, with the same rental rate, rental duration, and replacement cost.
-
Show the customers who have rented films that have not been rented by any other customer in the same category, language, description, rental rate, rental duration, and release year.
-
List the staff members who have handled rentals for the same customer on the same day, with the same rental rate, late fees, rental duration, and rental duration.
-
Retrieve the actors who have appeared in films directed by the same director and have the same rating as another film they've appeared in, from the same country, and have worked with the same actor, and have the same language.
-
Show the films that have been rented by a customer who has also rented a film from the same category, with the same rating, rental rate, rental duration, release year, and replacement cost, on the same day.
-
List the customers who have rented the same set of films as another customer in the same category, language, description, rental rate, rental duration, release year, and replacement cost.