Pattern Matching with LIKE
The LIKE operator lets you search for patterns in text, not just exact matches.
Wildcards
| Wildcard | Meaning |
|---|---|
% | Any sequence of characters (including none) |
_ | Exactly one character |
Common Patterns
-- Starts with 'A'
WHERE name LIKE 'A%'
-- Ends with 'son'
WHERE name LIKE '%son'
-- Contains 'ar'
WHERE name LIKE '%ar%'
-- Second character is 'a'
WHERE name LIKE '_a%'
Exercises
Loading exercise...
Loading exercise...
Loading exercise...
Loading exercise...
Loading exercise...
Case Sensitivity
In SQLite (which powers this playground), LIKE is case-insensitive by default:
'Apple' LIKE 'a%'matches
In other databases like PostgreSQL, LIKE is case-sensitive. Use ILIKE for case-insensitive matching.
Loading exercise...
Free Practice
Loading SQL editor...
Try these patterns:
- Find all users with 3-letter names (
___) - Find users with emails from a specific domain
- Combine LIKE with other conditions using AND

