Skip to content
Intermediate SQL
Intermediate SQL
Here you can access every table used in the course. To access each table, you will need to specify the cinema
schema in your queries (e.g., cinema.reviews
for the reviews
table.
Take Notes
Add notes about the concepts you've learned and SQL cells with queries you want to keep.
Add your notes here
DataFrameas
df
variable
-- Add your own queries here
SELECT *
FROM cinema.reviews
LIMIT 5
Explore Datasets
Use the descriptions
, films
, people
, reviews
, and roles
tables to explore the data and practice your skills!
- Which titles in the
reviews
table have an IMDB score higher than 8.5? - Select all titles from Germany released after 2010 from the
films
table. - Calculate a count of all movies by country using the
films
table.
#-- Count the number of records in the people table
SELECT COUNT(*) AS count_records
FROM people;
#-- Count the number of birthdates in the people table
SELECT COUNT(birthdate) as count_birthdate FROM people
#-- Count the languages and countries represented in the films table
SELECT COUNT(language) AS count_languages, COUNT(country) AS count_countries
FROM films;
-- Count the distinct countries from the films table
SELECT COUNT(DISTINCT(country)) as count_distinct_countries FROM films
-- Select film_ids and imdb_score with an imdb_score over 7.0
SELECT film_id, imdb_score FROM reviews
WHERE imdb_score > 7
-- Select film_ids and facebook_likes for ten records with less than 1000 likes
SELECT film_id, facebook_likes FROM reviews
WHERE facebook_likes < 1000
LIMIT 10;
-- Count the records with at least 100,000 votes
SELECT COUNT(num_votes) as films_over_100K_votes FROM reviews
WHERE num_votes >= 100000
-- Select the title and release_year for all German-language films released before 2000
SELECT title, release_year FROM films
WHERE release_year < 2000 AND language ='German'
-- Update the query to see all German-language films released after 2000
SELECT title, release_year
FROM films
WHERE release_year > 2000
AND language = 'German';
-- Select all records for German-language films released after 2000 and before 2010
SELECT *
FROM films
WHERE language ='German' AND release_year > 2000 AND release_year <2010