Thread: Wild Cards

Wild Cards

From
""
Date:
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?





Re: Wild Cards

From
Adam Haberlach
Date:
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';

--
Adam Haberlach            |A cat spends her life conflicted between a
adam@newsnipple.com       |deep, passionate, and profound desire for
http://www.newsnipple.com |fish and an equally deep, passionate, and
'88 EX500                 |profound desire to avoid getting wet.

Re: Wild Cards

From
"Oliver Elphick"
Date:
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.Elphick@lfix.co.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



Re: Wild Cards

From
"Rob Arnold"
Date:
it's % not *
----- Original Message -----
From: "<No Name>" <bobmarley4u2c@yahoo.com>
To: <pgsql-general@postgresql.org>
Sent: Thursday, January 25, 2001 8:40 AM
Subject: Wild Cards


> 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?
>
>
>
>
>