Skip to main content

What does LIKE do?

LIKE is a filtering operator that searches strings by pattern in SQL queries.

It's used inside WHERE, to find values similar to a given template. It works with two special characters:

  • %, replaces any number of characters (including zero);
  • _, replaces exactly one character.

Examples:

  • WHERE name LIKE 'A%', finds every row where the name starts with "A".
  • WHERE city LIKE '%burg', finds rows where the city's name ends in "burg".
  • WHERE code LIKE '12__', finds every four-digit code that starts with "12".

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.