Re: [SQL] Select like when searching for whole word and optimizing it -- regexp? - Mailing list pgsql-sql

From Emils Klotins
Subject Re: [SQL] Select like when searching for whole word and optimizing it -- regexp?
Date
Msg-id 199906100837.LAA02976@omega.bkc.lv
Whole thread Raw
In response to Select like when searching for whole word and optimizing it  (Michal Samek <webmaster@tony.cz>)
List pgsql-sql
[9 Jun 99,, 10:41] Michal Samek wrote:

> In my e-shop I'm using the searching based on select like command;
> something like
> SELECT * FROM kat WHERE name LIKE '%some_text%';
> and when searching for the whole word:
> SELECT * FROM kat WHERE name LIKE '% some_text %';
> For this is necessary to maintain the name column with one space added
> before and after the name column value (to match starting and ending
> words). It's working but very ugly. 
> 
> Maybe there is some better way to search for the whole word? 
Try regexp searching. Don't know if available at 6.4, but definitely is there at 6.5
SELECT * FROM kat WHERE name ~* ' your regexp ';




Emils Klotins       e-mail: emils@mail.usis.bkc.lv
Systems Manager     URL: http://www.usis.bkc.lv/
USIS Riga           7 Smilsu Str., Riga LV1050, LATVIA



pgsql-sql by date:

Previous
From: "Nikolay Mijaylov"
Date:
Subject: Re: [SQL] automatic incrementation
Next
From: Stuart Rison
Date:
Subject: Re: [SQL] fields with float[48] type question