Skip to content
Justice Tech School

LIKE and Wildcards

LIKE matches text patterns. % stands for any number of characters and _ for exactly one. Use it for "starts with", "ends with" and "contains" searches. In many databases LIKE ignores case, and in others it does not.

Example
SELECT name
FROM students
WHERE name LIKE 'A%';

Result

name
Ada
Amina
Example
SELECT name
FROM students
WHERE name LIKE '%a';

Result

name
Ada
Amina
Example
SELECT name
FROM students
WHERE name LIKE '_i%';

Result

name
Sipho

Exercise

Names that start with the letter A.

SELECT * FROM students WHERE name  'A%';

Quiz Test

What does '%an%' match?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.