abdou / classroom
← Database classroomDATABASE REFERENCE

EVERY TABLE, EVERY COLUMN

Know your database.

A printable cheat sheet for the database you are using.

1,905 dialogue records across 11 episodes. Start with SELECT, filters, expressions, and grouping.

Open playground ↗

SQL QUICK REFERENCE

Build your query.

SELECT column, expression AS alias
FROM table_name
JOIN other_table ON table_name.id = other_table.table_id
WHERE condition
GROUP BY column
HAVING aggregate_condition
ORDER BY column DESC
LIMIT 10;

Include only the clauses your question needs. WHERE filters rows; HAVING filters groups.

Choose columns
SELECT title, year FROM movies;
Choose rows
WHERE year >= 2000 AND imdb_score > 8
Match text
WHERE title LIKE '%Star%'
Unique values
SELECT DISTINCT director FROM movies;
Missing values
WHERE column_name IS NULL
Summarize
COUNT(*) · SUM(column) · AVG(column)
Combine text in SQLite
title || ' (' || year || ')'

Examples using movies are for IMDb Movies. Use the exact names in the selected database’s table reference.

Read the full SQL reference →