Subject Re: [firebird-support] What key word specifies a search for an entire word?
Author Richard Damon
On 11/29/19 4:32 PM, Clyde Eisenbeis cte677@... [firebird-support]
wrote:
>  
> Not sure what pattern is.  If I am searching for two words I use OR or
> AND. 
>
> "SELECT fstName, fiKeyID FROM Members WHERE lower(fstName) LIKE lower(
> @p0 ) AND lower(fstName) LIKE lower( @p1 ) "
>
> I prefer the word LIKE.  Is easier to avoid errors vs. using '='.  Are
> there advantages to using '='?
>
LIKE, because it is designed as a partial match, can't use a normal
index, so often ends up doing a table scan.

= since it only matches the full field, can easily use an index, and if
an appropriate index is available, can avoid scanning the whole table.


Also, in your above sample, fstName needs to match BOTH p0 and p1, which
isn't usual unless you are looking for the presence of both of two
strings in any order.

--
Richard Damon