Re: select * from test where name like 'co_%'

From: Kenneth Marshall <ktm(at)rice(dot)edu>
To: "sivapostgres(at)yahoo(dot)com" <sivapostgres(at)yahoo(dot)com>
Cc: Postgresql General Group <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: select * from test where name like 'co_%'
Date: 2020-03-10 12:54:28
Message-ID: 20200310125428.GV32117@aart.rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Mar 10, 2020 at 12:49:01PM +0000, sivapostgres(at)yahoo(dot)com wrote:
> Hello,
> What returns when I run a query like this;
> Select * from test where name like 'co_%';
> I expect anything that starts with 'co_' and NOT 'co' only.  Am I right?  But I get every names that starts with 'co'. Why ?
> Happiness Always
> BKR Sivaprakash

Hi,

Check out the documentation:

https://www.postgresql.org/docs/12/functions-matching.html#FUNCTIONS-LIKE

You have 2 meta characters there. The '_' matches any character also.

Regards,
Ken

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paul Foerster 2020-03-10 12:59:55 Re: select * from test where name like 'co_%'
Previous Message sivapostgres@yahoo.com 2020-03-10 12:49:01 Re: select * from test where name like 'co_%'