A database is a set of tables. SELECT asks a table for its rows, and you choose which columns come back.
Ask the databaseTry itSELECT columns FROM table; reads rows. * means every column.
Pick the columnsExerciseName the columns you want, separated by commas, in the order you want them.
The query that would not runDebugSQL errors say near what they got stuck. That word is where to look.
Rename and calculateExerciseAS renames a column in the result. Columns can be calculated with + - * /.
Quick checkQuizSELECT picks columns, FROM picks the table, AS renames, and every statement ends with ;.
2. Filter with WHERE
Ask only for the rows you need: players from one country, rich players, names that start with S.
Players from one countryExerciseWHERE filters rows. Text is written in 'single quotes' in SQL.
Strong and richExerciseCombine conditions with AND (both) and OR (either). Numbers have no quotes.
The missing quotesDebugWithout quotes it is a column name; with 'quotes' it is a value. A very common SQL mistake.
Names that start with SExerciseLIKE 'S%' starts with S, '%ow' ends with ow, '%a%' contains a.
Quick checkQuizWHERE + comparisons, AND/OR to combine, LIKE with % to search text.
3. Sort, count and group
Top-3 lists, totals and statistics: ORDER BY, LIMIT, COUNT and GROUP BY.
The top 3ExerciseORDER BY column DESC sorts high to low, LIMIT n keeps the first n rows. ORDER BY comes before LIMIT.
How many players?ExerciseCOUNT, SUM, AVG, MIN and MAX turn many rows into one answer.
Players per countryExerciseGROUP BY makes groups, and the counting functions work on each group.
Counting in the wrong placeDebugWHERE filters rows before grouping; HAVING filters groups after it.
Quick checkQuizORDER BY, LIMIT, COUNT/SUM/AVG, GROUP BY, HAVING: the tools behind every dashboard.
4. Add, change and remove
INSERT a new player, UPDATE coins, DELETE a cheater, and learn the one mistake that wipes a whole table.
A new player joinsExerciseINSERT INTO table (columns) VALUES (values); adds a row. A PRIMARY KEY id numbers itself.
Pixel buys coinsExerciseUPDATE table SET column = value WHERE condition; changes only the rows that match.
The update that hit everyoneDebugUPDATE or DELETE without WHERE touches every row. Always write the WHERE first.
Ban a playerExerciseDELETE FROM table WHERE condition; removes rows. There is no undo, so the WHERE matters.
Quick checkQuizINSERT adds, UPDATE changes, DELETE removes, and WHERE keeps it all under control.
5. Your own tables, and JOIN
Design tables with CREATE TABLE, and connect tables with JOIN to answer "who bought what?".
Create a tableExerciseCREATE TABLE name (column TYPE, ...); with INTEGER, TEXT, REAL, PRIMARY KEY and NOT NULL.
One value shortDebugThe number of values must match the number of columns.
Who bought what?ExerciseJOIN ... ON connects rows from different tables through their ids. table.column says which table a column comes from.
Quick checkQuizDesign tables with types and keys, split data into tables, and JOIN them back together.
6. SQL exam
Ten questions about everything in this course. Pass with 8 right answers.
The SQL examExamYou can query, filter, sort, count, change and design databases. That is a real job skill.
7. Final project
Design and fill the database for an app of your own, ask it a real question, and send it for review.
The database of your appFinal projectDesigning tables, filling them and asking them questions is exactly what backend developers do every day.
How the course works
You learn by doing: each lesson explains one idea, then you write real code in the editor and see the result right away. The first lesson is free to try without an account; sign up to save your progress and continue.
Try it
Change working code and see the result immediately.
Exercise
Complete a task. A checklist confirms each requirement as you type.
Debug
Fix code that is broken on purpose, and learn why it failed.