Skip to content

Intermediate SQL Sandbox

👋 Welcome to your new workspace! You can use this interactive notebook to take notes, explore the course data, and practice your SQL skills!

The films, people, reviews, and roles tables from Intermediate SQL are available for you to query in the SQL cell below! Click inside the cell and press "Run" to execute the pre-written query or write your own query!

Note that the tables are stored in a schema named cinema. To access each table, you must add "cinema." before the table name (e.g., cinema.reviews).

Spinner
DataFrameas
books
variable
-- Select all entries from the reviews table
SELECT * 
FROM cinema.reviews
LIMIT 100;

Click "Add markdown" to add and edit text cells for notes, and "Add SQL" to continue practicing your queries!

Intermediate SQL Interactive Cheat Sheet

Below are some interactive examples of things you learned from the course. Bookmark this page as a reference and a place to experiment with queries!

Filtering

Use WHERE to filter records in a table.

Spinner
DataFrameas
df
variable
SELECT *
FROM cinema.reviews
WHERE imdb_score > 8.5

Use AND and OR in combination with WHERE for more specific filtering.

Spinner
DataFrameas
df
variable
SELECT title, country, release_year
FROM cinema.films
WHERE country = 'Germany'
	AND release_year > 2010;

Use BETWEEN to filter for records within a specified range (inclusive).

Spinner
DataFrameas
df
variable
SELECT title, budget
FROM cinema.films
WHERE budget BETWEEN 1000000 AND 5000000;

Use LIKE and NOT LIKE to filter records for (or without) a pattern. The % wildcard matches one, zero, or many characters. The _ wildcard matches a single character.

Spinner
DataFrameas
df
variable
SELECT title
FROM cinema.films
WHERE title LIKE '%Alien%';

Use WHERE IN to filter for multiple conditions.

Spinner
DataFrameas
df
variable
-- Movies titles released in 1990 or 2000
SELECT title, release_year
FROM cinema.films
WHERE release_year IN (1990, 2000);

Use NULL in your queries to find or filter out records with missing values.

Spinner
DataFrameas
df
variable
SELECT title, budget
FROM cinema.films
WHERE budget IS NULL;