SQL · Level 1 Filtering

SQL LIKE Patterns

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

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

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.

Sample data from the first test. The other tests use different rows, so write a query, not a list of answers.

users 5 rows
idINTEGERnameTEXTemailTEXT
1Ana[email protected]
2Bo[email protected]
3Cy[email protected]
4Di[email protected]
5Eve[email protected]
solution.sql
Test Suites Pending
Output