The language databases actually speak. Create a database, build a table, drop in some rows, then ask it questions — one interactive slide at a time.
This is the full written version of an interactive, slide-by-slide lesson deck used in teaching. Everything covered in the deck is below — open the interactive version to work through it with live diagrams, worked examples and a practice quiz where included.
SQL is not case-sensitive — SELECT = select = Select. But writing keywords in UPPERCASE is standard practice.
Every column in a table must have a data type — it tells MySQL what kind of value to expect.
💡 You must supply a value for id — it is the PRIMARY KEY and must be unique for every row.
SELECT * for exploration; use specific columns in real apps for speed.💡 Use LIKE '%term%' to search text — e.g. WHERE name LIKE 'A%' finds all names starting with A.
💡 Add LIMIT 10 at the end to get only the top N results — great for leaderboards!
DELETE FROM t WHERE … — removes specific rowsDELETE FROM t — removes all rows (slow)TRUNCATE TABLE t — wipes all rows instantly, resets IDsGROUP BY groups rows so functions run per group.CREATE DATABASE makes an empty container to hold tables. CREATE TABLE defines the actual structure — the columns, their data types, and the constraints — inside that container. You run CREATE DATABASE once, then CREATE TABLE for each table you need.
SELECT columns, FROM table, WHERE row conditions, GROUP BY grouping, HAVING conditions on groups, then ORDER BY sorting. The database does not execute them in that order — FROM and WHERE run before SELECT — which is why you cannot use a column alias defined in SELECT inside a WHERE clause.
The interactive deck adds live diagrams, step-by-step reveals and practice activities that this written version can't carry.