Re: [GENERAL] SQL Regular expression - Mailing list pgsql-general

From John M. Flinchbaugh
Subject Re: [GENERAL] SQL Regular expression
Date
Msg-id Pine.LNX.4.10.9907142350520.7950-100000@butterfly.hjsoft.com
Whole thread Raw
In response to SQL Regular expression  ("Albert Chen" <chen6178@hotmail.com>)
List pgsql-general
On Wed, 14 Jul 1999, Albert Chen wrote:
> I want to search my database table named ex,  whose the attribute is
> subject,
> and list the results that matches the keyword 'electric'.
> I run the SQL command: SELECT subject FROM ex WHERE subject='*electric*';

use one of the following:

select subject from ex where subject~'.*electric.*';

or

select subject from ex where subject like '%electric%';

the first uses postgresql's regular expressions, which are much like unix
regex.  the second uses the sql standard like clause.  this one will be
more portable to other dbms.

____________________}John Flinchbaugh{______________________
| -> glynis@hjsoft.com <-             john@cs.millersv.edu |
|    glynis@netrax.net      http://www.hjsoft.com/~glynis/ |
~~Powered by Linux: Reboots are for hardware upgrades only~~


pgsql-general by date:

Previous
From: "Albert Chen"
Date:
Subject: SQL Regular expression
Next
From: "Tiago Hermans"
Date:
Subject: Multi-Threading?