0PricingLogin
SQL Academy · Lesson

LIKE Patterns and Wildcards

Use LIKE with % and _ wildcards, understand case sensitivity, and prefer ILIKE on PostgreSQL for case-insensitive matching.

What LIKE Does

LIKE matches a string against a pattern. Two wildcards:

  • % — any sequence (including empty)
  • _ — exactly one character

Simple Examples

Match by prefix, suffix and substring:

SELECT email FROM users WHERE email LIKE 'a%';        -- starts with a
SELECT email FROM users WHERE email LIKE '%@gmail.com'; -- ends with @gmail.com
SELECT email FROM users WHERE email LIKE '%admin%';     -- contains admin

All lessons in this course

  1. LIKE Patterns and Wildcards
  2. IN and NOT IN for Sets
  3. BETWEEN for Ranges
  4. IS NULL, IS NOT NULL and COALESCE
← Back to SQL Academy