🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to PostgreSQL Notes
Topic #26

PostgreSQL LIKE


LIKE

The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.

There are two wildcards often used in conjunction with the LIKE operator:

  • % The percent sign represents zero, one, or multiple characters
  • _ The underscore sign represents one, single character

Starts with

To return records that starts with a specific letter or phrase, add the % at the end of the letter or phrase.

Example

SELECT * FROM customers
WHERE customer_name LIKE 'A%';

Contains

To return records that contains a specific letter or phrase, add the % both before and after the letter or phrase.

Example

SELECT * FROM customers
WHERE customer_name LIKE '%A%';

ILIKE

Note: The LIKE operator is case sensitive, if you want to do a case insensitive search, use the ILIKE operator instead.

Example

SELECT * FROM customers
WHERE customer_name ILIKE '%A%';

Ends with

To return records that ends with a specific letter or phrase, add the % before the letter or phrase.

Example

SELECT * FROM customers
WHERE customer_name LIKE '%en';

The Underscore _ Wildcard

The _ wildcard represents a single character.

It can be any character or number, but each _ represents one, and only one, character.

Example

SELECT * FROM customers
WHERE city LIKE 'L_nd__';

Want to go beyond the notes?

Join CodingNow 2.0's PostgreSQL course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

PostgreSQL LIKE – FAQs

Quick answers about learning PostgreSQL LIKE in PostgreSQL.

This free note from CodingNow 2.0 explains PostgreSQL LIKE in PostgreSQL — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every PostgreSQL topic on CodingNow 2.0, including PostgreSQL LIKE, is 100% free with no signup required.
With focused practice, most students grasp PostgreSQL LIKE in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now