Re: Wild Cards

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: "<No Name>" <bobmarley4u2c(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Wild Cards
Date: 2001-01-27 10:16:16
Message-ID: 200101271016.f0RAGGF23603@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adam Haberlach wrote:
>On Thu, Jan 25, 2001 at 08:40:23AM -0500, <No Name> wrote:
>> I am not able to get Wildcards in PostgreSQL, I know its * (asterisk), but
>> its not working. can someone show me a example or something?
>
>It's % and you have to use the LIKE operator.
>
>SELECT * FROM thistable WHERE name LIKE '%marley';

Alternatively use regular expressions as with grep:

SELECT * FROM thistable WHERE name ~* 'scrooge$'

~ is regular expression match
~* is case-insensitive regular expression match

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Come now, and let us reason together, saith the LORD;
though your sins be as scarlet, they shall be as white
as snow; though they be red like crimson, they shall
be as wool." Isaiah 1:18

Browse pgsql-general by date

  From Date Subject
Next Message Adriaan Joubert 2001-01-27 12:21:23 www.postgresql.de
Previous Message Oliver Elphick 2001-01-27 10:05:21 Re: get last sequence