logo_ironhack_blue 7

Lab | SQL Queries - Lesson 2.5

In this lab, you will be using the Sakila database of movie rentals. You can follow the steps listed here to get the data locally: Sakila sample database - installation.

The database is structured as follows: DB schema



Instructions

  1. Select all the actors with the first name ‘Scarlett’.
  2. How many films (movies) are available for rent and how many films have been rented?
  3. What are the shortest and longest movie duration? Name the values max_duration and min_duration.
  4. What's the average movie duration expressed in format (hours, minutes)?
  5. How many distinct (different) actors' last names are there?
  6. Since how many days has the company been operating (check DATEDIFF() function)?
  7. Show rental info with additional columns month and weekday. Get 20 results.
  8. Add an additional column day_type with values 'weekend' and 'workday' depending on the rental day of the week.
  9. Get release years.
  10. Get all films with ARMAGEDDON in the title.
  11. Get all films which title ends with APOLLO.
  12. Get 10 the longest films.
  13. How many films include Behind the Scenes content?