Pattern Matching with LIKE
LIKE searches for patterns in text.
Wildcards:
- % matches any number of characters
- _ matches exactly one character
Examples:
WHERE first_name LIKE 'J%' -- Starts with J
WHERE email LIKE '%@gmail.com' -- Ends with @gmail.com
WHERE first_name LIKE '_ohn' -- 4 letters, ends in 'ohn'NOT LIKE finds non-matching patterns.
Check your understanding
Find all employees whose first name starts with 'J'.