Last updated

SQL LIKE

Definition: LIKE searches for a pattern in text using two wildcards: % matches any number of characters, and _ matches exactly one character.

Example 1 — starts with A

SELECT * FROM Customers
WHERE CustomerName LIKE 'A%';

Example 2 — ends with y

SELECT * FROM Customers
WHERE Country LIKE '%y';

Example 3 — contains "er"

SELECT * FROM Customers
WHERE CustomerName LIKE '%er%';

Example 4 — the single-character wildcard

_ stands for exactly one character. This finds 5-letter cities starting with "Berl":

SELECT * FROM Customers
WHERE City LIKE 'Berl_';

💡 Tip: % for "any run of characters", _ for "one character". Combine them freely.

Try it Yourself
Output

          
Ad · responsive