Introduction to databases — Tutorial 4

Learning SQL queries


Exercise

Exercise 1 Write the following SQL queries:

  1. Which last names are not repeated in table actor?

  2. Is a copy of the movie ACADEMY DINOSAUR available for rent from store 1?

  3. Return the title and the release year of all films in one of the following categories: Family, Animation, Documentary.

Tip You can use the operator IN
  1. Find all customers (id, last name, first name) whose last name starts with the letter L.
    Tip You can use the operator LIKE
  2. Return the total paid by each customer. For each customer, display a single column containing first and last name and another column with the total amount paid. Order the result alphabetically by last name
Tip You can use the operator CONCAT
  1. Return the total revenue from the rentals across the stores in each country. Order by descending revenue.

  2. The first and last name of the actor that played in the most films. If two or more actors are tied, the query must return the names of all of them.