PostgreSQL like vs ilike

We know that we can find the data we are looking for by adding a WHERE clause to our SELECT statement, but what if you want to find a partial word?

Now, what if you only want to match on part of a data string? This is where LIKE and ILIKE come in handy. Let's say you want to find customers with the first name of Matt or Matthew. You can use the LIKE clause.

In this case, you will find all the customer with a first name that starts with Matt but can have any characters after it. (the % is a wildcard). So you will find Matt, Matthew, and others like Matty. ILIKE works the same way except it is a case insensitive match. ILIKE is slower than LIKE so default to LIKE if you can.

Talk PostgreSQL is a site designed to help you understand PostgreSQL, get PostgreSQL news, other helpful information. 
© Copyright 2019 - TalkPostgreSQL - All Rights Reserved
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram