SQL LIKE Operator

LIKE matches text against a pattern. % stands for any number of characters, and _ stands for exactly one.

Updated December 1, 2026

Syntax

WHERE column LIKE 'pattern'

Ends with

Every drink whose name ends in “Latte”.

SELECT name
FROM drinks
WHERE name LIKE '%Latte';
Result on the SQL Café sample data (3 rows)
name
Latte
Matcha Latte
Chai Latte

Starts with

Names that start with C.

SELECT name
FROM drinks
WHERE name LIKE 'C%';
Result on the SQL Café sample data (3 rows)
name
Cappuccino
Cold Brew
Chai Latte

Contains, and single-character wildcards

%o% finds an “o” anywhere. _ matches exactly one character, so '_e%' means “second letter is e”.

SELECT name
FROM drinks
WHERE name LIKE '_e%';
Result on the SQL Café sample data (2 rows)
name
Peppermint Tea
Lemonade

Common mistakes

Practice LIKE Operator interactively

Write real queries in your browser and get instant feedback in the lesson “IN, BETWEEN, LIKE” (Unit 2). New learners can start free from the first lesson.

Frequently asked questions

How do I search for a literal % or _?

Escape it: LIKE '%50!%%' ESCAPE '!' finds text containing “50%”.

Is there regex in SQL?

Many databases add it: ~ in PostgreSQL, REGEXP in MySQL. LIKE is the portable option.

Related SQL tutorials