🔍
👶 Kids📝 Blog About Contact 🚀 Get Started Free

SQL – LIKE

Search for patterns within text columns using the LIKE operator with wildcard characters.

When you need to find rows based on partial text matches — a name that starts with “A”, a city that ends in “i”, or an email domain of “gmail.com” — the LIKE operator is your tool. It uses two special wildcard characters: % matches any sequence of characters (including none), and _ matches exactly one character.

LIKE is case-insensitive in SQLite by default (though this varies by database). For case-sensitive matching, most databases provide ILIKE or require a specific collation setting.

Wildcard patterns

PatternMatches
’A%‘Starts with A
’%i’Ends with i
’%an%‘Contains “an” anywhere
’_eo%‘Second and third chars are “eo”

Try It Yourself — Interactive SQL Editor

Edit the query below and click Run Query ▶ to see live results powered by SQLite running directly in your browser.

SQLite – edit & run
Results
← Click Run Query ▶ to see results

Key Points

  • % matches zero or more of any characters
  • _ matches exactly one character
  • LIKE performs pattern matching, = performs exact matching
  • For complex patterns, consider REGEXP (not in all databases)

Pro Tip from CodesCompiler: The best way to learn SQL is to break things intentionally — modify the query above, change the WHERE conditions, try different columns. Every error teaches you something the docs cannot.

In the next lesson, we continue exploring SQL’s powerful feature set to build your database mastery.