Subject | Re: Is LIKE case sensitive? |
---|---|
Author | Adam |
Post date | 2005-11-16T22:42:36Z |
--- In firebird-support@yahoogroups.com, "William Gonzáles S."
<wgonzaless@y...> wrote:
There are two similar functions LIKE and CONTAINING. LIKE is case
sensitive, CONTAINING is insensitive.
Take your pick, these two are equivalent:
SELECT NAME FROM SOME_TABLE WHERE (UPPER(NAME) LIKE UPPER('%hou%'))
SELECT NAME FROM SOME_TABLE WHERE (NAME CONTAINING 'hou')
The advantage of using like (apart from being able to be case
sensitive), is that expressions of the form 'hou%' are internally
optimised to a STARTING WITH, which is in turn able to use an index to
quickly return results.
Adam
<wgonzaless@y...> wrote:
>William,
> Hello, I have several queries with `LIKE', but the
> results are not good for me, for example:
>
> SELECT NAME FROM SOME_TABLE WHERE (NAME LIKE '%hou%')
>
> It gives me records with: "house", "penthouse"
> but records: "House", "HOUSE", "PENTHOUSE" are
> ignored; I need a non case sensitive `LIKE', how can I
> solve this?
>
> Thanks in advance,
> William GS
>
There are two similar functions LIKE and CONTAINING. LIKE is case
sensitive, CONTAINING is insensitive.
Take your pick, these two are equivalent:
SELECT NAME FROM SOME_TABLE WHERE (UPPER(NAME) LIKE UPPER('%hou%'))
SELECT NAME FROM SOME_TABLE WHERE (NAME CONTAINING 'hou')
The advantage of using like (apart from being able to be case
sensitive), is that expressions of the form 'hou%' are internally
optimised to a STARTING WITH, which is in turn able to use an index to
quickly return results.
Adam