Filter rows with WHERE
WHERE is how a query stops being "show me everything" and starts answering a
real question. It filters rows before they're returned - the condition is
checked against every row, and only the ones where it's true make it into the
result. Everything else is discarded before it ever reaches you.
You can compare a column against a fixed value (age > 30), against another
column, or chain conditions together with AND/OR - this lesson starts with
the simplest case: one column, one value.
Same users table as before: id, name, country, age.
Your task: show the name and age of everyone whose country is Georgia.
You'll practice:
- Adding a
WHERE clause to a query
- Comparing a text column against a quoted value
Related reading: Filtering & Sorting: WHERE, ORDER BY, LIMIT →