WHERE filters rows — it keeps only those matching a condition. Together with SELECT, it answers the vast majority of data questions: "which students scored above 8?", "which orders shipped today?".
Filtering rows
SELECT name, package FROM studentsWHERE package > 8;SELECT * FROM studentsWHERE programme = 'Data' AND package >= 7; -- combine with AND / OR
Useful operators
WHERE package BETWEEN 5 AND 8 -- inclusive rangeWHERE programme IN ('Data', 'Web') -- any of a listWHERE name LIKE 'A%' -- starts with AWHERE email IS NULL; -- missing value (not = NULL)
Key takeaways
- 01WHERE keeps only the rows matching a condition.
- 02Combine conditions with AND / OR; group with parentheses.
- 03Handy operators: BETWEEN (range), IN (list), LIKE (pattern).
- 04Use IS NULL / IS NOT NULL for missing values — never = NULL.
