Filtering with WHERE
SELECT name, xp
FROM students
WHERE xp >= 100;
SELECT name
FROM students
WHERE name LIKE 'A%';
Comparisons and patterns
WHEREfilters rows before they're returned, only rows where the condition is true make it into the result.LIKE 'A%'matches names starting withA,%is a wildcard for "anything, any length".- Combine conditions with
AND/OR, and control the result order withORDER BY:
SELECT name, xp
FROM students
WHERE xp >= 50 AND name != 'Ada'
ORDER BY xp DESC;
ORDER BY xp DESC sorts highest-XP first, drop DESC (or use ASC) to sort lowest first.