Wild Cards

Started by <No Name>about 25 years ago5 messagesgeneral
Jump to latest
#1<No Name>
bobmarley4u2c@yahoo.com

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?

#2Josh Rovero
provero@home.com
In reply to: <No Name> (#1)
Re: Wild Cards

select * from testdata where key like '%substring%';

It uses regular expression form, not file glob form.
Try percent signs before and after the substring
you want to match.

wrote:

Show quoted text

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?

#3Adam Haberlach
adam@newsnipple.com
In reply to: <No Name> (#1)
Re: Wild Cards

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.

#4Oliver Elphick
olly@lfix.co.uk
In reply to: Adam Haberlach (#3)
Re: Wild Cards

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

#5rob
rob@cabrion.com
In reply to: <No Name> (#1)
Re: Wild Cards

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

Show quoted text

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?