The LIKE and ILIKE keywords are used for filtering results based on patterns. For example, rather than searching for rows where x = 'some value', we can use LIKE to match all rows that ending with a specific pattern.

There are two main wildcard characters in SQL:

  1. % matches any sequence of characters
  2. _ matches any single character
    1. Note that we can have multiple underscores in a row (consider the case of matching versions, say: Version A4, Version B1, etc can be matched with `Version __)

Note

LIKE is case sensitive. We can use ILIKE if we want to do case-insensitive queries.