Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMP2400/6240 - Relational Databases
Sample SQL Questions
The Movie Database
The moviedb relational database schema is as defined in the Assignment 1 specification.
Questions
Your task is to write SQL queries that answer the following questions. For each question,
your answer must be a single SQL query (that may contain subqueries).
1. How many unique persons are in the database?
2. How many different first names of persons are there in database?
3. List all distinct first names of persons in the database, along with for each the number
of persons that have that first name, ordered by that number.
4. How many persons share the most common first name?
5. What is the most common first name?
6. Find all the movies made in Australia. List the titles and production years of these
Australian movies.
7. Which directors have directed crime movies (i.e., movies whose major genre is ’crime’)?
List the directors’ first and last names, and the titles and production years of these
crime movies.
8. Which directors have directed crime movies (i.e., movies whose major genre is ’crime’)?
List only the directors’ first and last names, without repetition.
9. List all movies (title and production year) for which any award, of any kind, has been
won, along with the total number of awards won for each movie, ordered by the number
of awards (most award-winning movie first).