Filtering and sorting
Combine conditions, match patterns and order results predictably.
What you will be able to do
- Combine AND and OR
- Use LIKE and IN
- Handle NULL correctly
Filters are where SQL becomes precise. Group conditions carefully — AND binds more tightly than OR, so use parentheses when mixing them.
SELECT title, minutes, level
FROM lessons
WHERE (level = 'Beginner' OR level = 'Intermediate')
AND minutes <= 15
AND title LIKE '%form%'
ORDER BY minutes ASC, title ASC;| Operator | Meaning |
|---|---|
| = | Exact match |
| <> | Not equal |
| LIKE | Pattern match; % is any length, _ is one character |
| IN | Matches any value in a list |
| BETWEEN | Inclusive range |
| IS NULL | Tests for a missing value |
Your turn
EasyFind short lessons
Return titles of lessons under 12 minutes, ordered by minutes ascending.
SQL · starter
SELECT title, minutes FROM lessonsCheck your understanding before moving on.
Knowledge checkQuestion 1
How do you test for a missing value?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.