🗃️WHERE Clause
Also known as WHERE, SQL WHERE, SQL Filter
The part of a SQL command that keeps only the rows that pass a test.
Think of it like
It is like a sieve. Only the rows that pass the test fall through.
Example
Jack only wants this week's orders. He adds WHERE created_at >= '2026-11-09' and gets just those rows.
Why it matters
It decides which rows a command touches. In a DELETE, a missing or wrong WHERE can wipe the wrong data.
Definition
Example code
sql
SELECT name
FROM customers
WHERE city = 'Paris' AND active = true;Common mistake
Key takeaways
- 1A test per row. Rows that pass are kept.
- 2AND and OR. Join tests to be more exact.
- 3Aims changes too. UPDATE and DELETE use it to pick rows.