AtomLearnAtomLearn
DashboardGoalsPathAchievementsReviewSign In
DashboardSQL & DatabasesFiltering with WHERE
SQL & DatabasesNot Started

Filtering with WHERE

Filter rows with WHERE — comparison operators and AND / OR

0%
Knowledge0%
Learn & Drill
Fluency0%
Drill & Speed
Retention0%
Mastery & Review
Confidence0%
All modes
Practice
Knowledge
Fluency
Retention

Knowledge Debt detected

You can study this freely — but your score may plateau if these foundations have gaps. The Mastery badge requires them to be solid.

Explanation

WHERE filters which rows a query returns.

sql
SELECT name, salary
FROM employees
WHERE salary > 80000;

Comparison operators: =, != (or <>), <, >, <=, >=

Combining conditions:

  • AND — both conditions must be true
  • OR — at least one condition must be true
sql
SELECT *
FROM employees
WHERE department = 'Engineering' AND salary > 80000;

Text values go in single quotes: WHERE department = 'Engineering'. Numbers don't need quotes: WHERE age > 18.

Examples

Filtering with AND

Returns engineers earning more than 80000

SELECT id, name, salary
FROM employees
WHERE department = 'Engineering'
  AND salary > 80000;

How well did you understand this?

Next in SQL & Databases

Sorting with ORDER BY

Continue