Filtering rows with WHERE

Stage 1: Basics · Lesson 2 of 17 · 5 min read · free, interactive

WHERE keeps only the rows that match a condition. It goes after FROM:

SELECT name, level FROM players WHERE level >= 10;

Comparison operators: = equal, <> not equal, <, <=, >, >=. Text and dates go in single quotes:

SELECT name, country FROM players WHERE country = 'VN';
SELECT name, joined_on FROM players WHERE joined_on < '2025-03-01';

Dates written as 'YYYY-MM-DD' compare in calendar order.

Tip: Text comparisons are case-sensitive: 'vn' does not equal 'VN'.

Practice

Each answer runs in your browser and is checked on hidden data.

Previous: Your first SELECT · Next: Sorting with ORDER BY and LIMIT · All lessons