How to select similar values in PostgresSQL using LIKE?

To select rows in which a particular column value contains a particular word, use LIKE and in inverted commas along with % symbol.

If the values have to start with a certain word, use %word and if the word has to end with a specific word, use word%. Use %word% if the particular word is anywhere in a given column's value. This is a case sensitive method.

Example Query -

select * from yt_records where video_title LIKE '%Mumbai%'; 

The above query selects all records in which there is a word Mumbai in them. 

Leave a comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.