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.
- Write the query: Return the
nameof every item in theweaponcategory. Row order does not matter. - Write the query: Return the
nameandpriceof items that cost more than 10. Row order does not matter. - Find the bug: Return the
nameof every player at level 10 or higher. Row order does not matter.
Previous: Your first SELECT · Next: Sorting with ORDER BY and LIMIT · All lessons