Instructions

In this assignment, you will query a database of movies, actors/actresses, and directors. This data is a subset of the Internet Movie Database and is used in compliance with their terms and conditions.

To load this database into PostgreSQL:

  1. Create a new database in pgAdmin by clicking on Databases in the left pane, and then selecting Edit -> New Object -> New Database... from the top menu. Name the new database imdb.
  2. You should now see imdb in the list of databases in the left pane of pgAdmin. Click on it, and then select Tools -> Restore... from the top menu. Find the file imdb.backup and restore it.

You should now have four tables in the the imdb database: cast_info, movies, people, and role_type.

Questions

Use the imdb database to answer the following questions.

  1. List the titles of all of the movies (movies table).

  2. List the titles of all movies produced in 2012.

  3. List the titles and ratings of all movies produced in 2012, and sort them in descending order by rating.

  4. List the titles of all movies produced in either 1992 or 2012.

  5. List the titles and ratings of all movies with ratings between 8.1 and 8.3.

  6. Using table people, list all those whose names contain ‘ford’.

  7. Get the distinct role types of roles in the cast_info table.

  8. List of the movies with at least 500,000 votes.

  9. Find the movie with the best overall rating.

  10. Write a REGEX statement to find any name in table people with “ford,” where “ford” can be upper or lower case.