Subject Re: CONTAINING in SELECT statement and indexes
Author javaguru_uk
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...> wrote:
>
> At 02:25 AM 3/12/2007, you wrote:
>
>
> >With regards to my question, I do use the alternative you have just
> >mentioned, but for huge amounts of text. The solution I was looking
> >for is more for short strings such as fullName of an individual. Then,
> >I may want to find all the people that have the name in the beginning,
> >middle or end of the string. But I guess the solution would be to
> >split the full name into first, middle and last, as well as have the
> >column that stores the combination of the three. Then, index the
> >first, middle, and last, and search on that. That more or less is what
> >you have described, right?
>
> No, it is altogether different.
>
> But for name searches, where your search keys are going to be on the
first characters of the first name or last name, you don't need
keywords. You would store two indexed columns: "First names" and
"Last Name" plus (if you need it) a computed field for "Full Name".
Then your searches would be on one or both of the indexed fields.
>
> create table blah (
> ...,
> first_name varchar(60),
> last_name varchar(60),
> .....
> full_name computed by (last_name || ', ' || first_names),
> ... )
>
> (or whatever combination suits).
>
> Note, it is not essential to store the full name at all, since you
can select the full name in any query by concatenating the first names
and last name elements to output a derived field. This is often a
better option, in case your applications need a variety of full name
formats.
>
> ./heLen
>

Hi Helen, once again thanks.
Yes, you are right. We don't really need the full name as it can be
calculated from the others. The reason I want to search on both the
first and last name is because where I live, there are certain first
names that are also used as last names. I don't know if that happens
also in english speaking countries. One example that surprised me the
other day is that I used to think that Paulo (equivalent to Paul) is
also used as a surname. This was the first time I heard of someone
with Paulo as his surname.

Anyway, thanks once again.

All the best,

Fidel.

PS: By the way, I just got a copy of your book and I must say that you
have written the book I really needed. Thanks for that too.