Overview
Find the users of one email domain with LIKE, and anchor the pattern so a look-alike domain doesn't sneak into the results.
- LIKE with % and _
- Anchoring a pattern
- Look-alike matches
Short Course
LIKE matches text patterns: % stands for any characters, _ for exactly
one. Trap: '%shop.io' also matches [email protected]. Anchor the part that
matters, like '%@shop.io'.
WHERE email LIKE '%shop.io' -- also workshop.io!
WHERE email LIKE '%@shop.io' -- only the shop.io domain
Task
Return the name of every user whose email address is at the shop.io
domain, ordered by name. In the database below, Bo's workshop.io address
doesn't count.
Database
Sample data from the first test. The other tests use different rows, so write a query, not a list of answers.
| idINTEGER | nameTEXT | emailTEXT |
|---|---|---|
| 1 | Ana | [email protected] |
| 2 | Bo | [email protected] |
| 3 | Cy | [email protected] |
| 4 | Di | [email protected] |
| 5 | Eve | [email protected] |
Test Suites
Pending
Next
Output