9951 explained code solutions for 126 technologies


postgresqlHow do I use the PostgreSQL ILIKE operator?


The PostgreSQL ILIKE operator is used to perform case-insensitive pattern matching. It is similar to the LIKE operator, but performs a case-insensitive search.

Example code

SELECT *
FROM table_name
WHERE column_name ILIKE '%string%';

Output example

column_name
------------
String
string
STRING

Code explanation

  • SELECT *: selects all columns from the table.
  • FROM table_name: specifies the table from which the columns are selected.
  • WHERE column_name ILIKE '%string%': searches for the string in the specified column, regardless of case. The '%' is a wildcard character that matches any characters before or after the string.

Helpful links

Edit this code on GitHub