06 / SQL
Give messy data a shape
SQL is how you ask a table for a slice of the truth. Select the columns, filter the rows, and keep the question readable.
SQL · 12 min · 0/3 quiz strings accepted
Name the columns
SELECT * is a shrug. In a learning lab, name the columns you intend to show: title, language, completed.
FROM names the table. Everything after WHERE is the filter that keeps surprises visible.
SELECT title, language FROM lessons WHERE completed = 0;
Filter before you decorate
WHERE completed = 0 is a boolean stored as a number in many tables. Be explicit. Do not rely on a UI to hide finished work.
AND chains conditions. OR needs parentheses when the question gets compound.
Order is part of the answer
ORDER BY path keeps a catalog feeling like a magazine index instead of a hash dump.
Glossary
- projection
- The columns a SELECT keeps.
- predicate
- The test in a WHERE clause.
- result set
- The rows that survive the question.
Quiz
Type the string. Keep the understanding.
The terminal cannot execute this language. It only prints ACCEPTED or REJECTED when your string matches the lesson.