WHERE Clause
Question
What does the WHERE clause do?
Hint
WHERE filters before GROUP BY and HAVING.
Explanation
The WHERE clause filters rows based on a condition. SELECT * FROM users WHERE age > 18 returns only users older than 18. WHERE supports operators: =, !=, <, >, <=, >=, BETWEEN, IN, LIKE, IS NULL, AND, OR, NOT. WHERE is applied before GROUP BY and HAVING. WHERE cannot filter on aggregate functions (use HAVING for that). WHERE can use subqueries. Indexes on WHERE columns improve query performance.
Related Resources
Related Lessons
- WHERE
Learn WHERE.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.