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{______________________
| -> [EMAIL PROTECTED] <-             [EMAIL PROTECTED] |
|    [EMAIL PROTECTED]      http://www.hjsoft.com/~glynis/ |
~~Powered by Linux: Reboots are for hardware upgrades only~~

Reply via email to