Ad space (banner)
🗄️SQL Lessons
Lesson 7 / 50

Fuzzy Matching with LIKE

This lesson covers fuzzy text matching with LIKE, so a search doesn't require an exact match. It's for anyone searching "SQL LIKE operator" or "SQL wildcard search."

LIKE searches for rows where part of a text column matches a pattern. % stands for "any sequence of characters" (so 'A%' means "starts with A"), which is what makes it "fuzzy" rather than exact.

The example uses WHERE name LIKE 'A%' to find every name that starts with "A." Try moving the % to the other side, or both sides, to see how "starts with," "ends with," and "contains" each behave differently.

A common early mistake is misplacing the %'A%' means "starts with A," '%a' means "ends with a," and '%an%' means "contains an" anywhere. Get the position wrong and the results won't match what you expected. This is the operator quietly powering most "search by keyword" boxes, including product search on e-commerce sites.

SQL
OUTPUT

💡 The SQL engine may take a few seconds to load the first time you run code.

Ad space (banner)
Ad space (in-article)