The LIKE operator searches for a pattern in a column using wildcards:
%: any number of characters (including none).
_: exactly one character.
Examples
'A%': starts with A
'%shop': ends with "shop"
'%tech%': contains "tech"
'_a%': second letter is "a"
In SQLite and MySQL, LIKE is case-insensitive for English letters.
💡 Key Takeaways: SQL LIKE & Wildcards
Mastering SQL LIKE & Wildcards helps you write clean and reliable SQL code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
SQL LIKE & Wildcards Code Example
SQL
SELECT CustomerName FROM Customers WHERE CustomerName LIKE 'A%';
SELECT CustomerName FROM Customers WHERE CustomerName LIKE '%tech%';
SELECT City FROM Customers WHERE City LIKE '_a%';
Free sign-in required · Google login available
SQL LIKE & Wildcards Practice Exercises
Check what you learned in “SQL LIKE & Wildcards”.
/ 3 solved
Fill in the blank
Find names that start with "S".
WHERE CustomerName LIKE ''
✓ Correct!Not quite. Try again.
Multiple choice
Which wildcard matches exactly one character?
✓ Correct!Not quite. Try again.
Code challenge
Select CustomerName of customers whose name contains 'Mart' or 'Books'.
Write the code in the live editor. Your answer is checked automatically.