← Databases & SQL
3 / 25
Lesson 3 — Filtering with WHERE
Filtering rows with WHERE
SELECT reads data. SELECT name, age FROM users returns those two columns for every row. Add WHERE to keep only the rows that match a condition. Conditions use =, <>, <, >, <=, >= and can be combined with AND / OR.
SELECT name FROM users WHERE age >= 18 AND city = 'Almaty'
Note: SQL uses a single = for comparison, and text goes in single quotes.
Why it matters: real tables have millions of rows; WHERE is how you fetch only the few you need.
Want it another way?
Task
Add a WHERE clause so only users older than 25 are returned. Expected: Alex and Dana.
Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.
Test your knowledge
A quick 3-question quiz on this lesson — instant feedback.