Re: Sql query with partial matching

From: "Brett W(dot) McCoy" <bmccoy(at)chapelperilous(dot)net>
To: Travis Bauer <trbauer(at)indiana(dot)edu>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Sql query with partial matching
Date: 2000-12-12 16:49:22
Message-ID: Pine.LNX.4.30.0012121147030.14220-100000@chapelperilous.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 7 Dec 2000, Travis Bauer wrote:

> How would I write an sql statement which would select all the
> records from a table where some string field contains
> some substring? Example: find all the records where f1 contains
> the world "cool."

SELECT * FROM mytable WHERE f1 LIKE '%cool%';

or use a regular expression:

SELECT * FROM mytable WHERE f1 ~* 'cool';

http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
"Pascal is Pascal is Pascal is dog meat."
-- M. Devine and P. Larson, Computer Science 340

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Jones 2000-12-12 17:00:49 Re: No postgres on Solaris
Previous Message Steve Heaven 2000-12-12 16:40:38 Re: Sql query with partial matching