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.
SELECT
categoryname,
filmtitle,
COUNT(*) rental_count
FROM (SELECT
f.title filmtitle,
rental_id rentalid,
c.name categoryname
FROM category c
JOIN film_category fc
ON c.category_id = fc.category_id
JOIN film f
ON fc.film_id = f.film_id
JOIN inventory i
ON f.film_id = i.film_id
JOIN rental r
ON i.inventory_id = r.inventory_id
GROUP BY 1,
2,
3
ORDER BY 2) sub
GROUP BY 1,
2
ORDER BY categoryname
DataFrameas
df
variable
SELECT
categoryname,
filmtitle,
COUNT(*) rental_count
FROM (SELECT
f.title filmtitle,
rental_id rentalid,
c.name categoryname
FROM category c
JOIN film_category fc
ON c.category_id = fc.category_id
JOIN film f
ON fc.film_id = f.film_id
JOIN inventory i
ON f.film_id = i.film_id
JOIN rental r
ON i.inventory_id = r.inventory_id
GROUP BY 1,
2,
3
ORDER BY 2) sub
GROUP BY 1,
2
ORDER BY categoryname
Current Type: Bar
Current X-axis: None
Current Y-axis: None
Current Color: None