Subject Re: [ib-support] Computed Fields
Author Arno Brinkman
Hi,

> What should be a real life usage of COMPUTED columns?
>
> In the case of some like:
> CREATE TABLE EMPLOYEE
> (FIRST_NAME VARCHAR(10) NOT NULL,
> LAST_NAME VARCHAR(15) NOT NULL,
> FULL_NAME COMPUTED BY (LAST_NAME || ', ' || FIRST_NAME));
>
> To get the full name, I'd use the expression LAST_NAME ||
> ', ' || FIRST_NAME in a SELECT clause.
>
> Is there a performance or some other kind of motivation to use COMPUTED
> columns?

Not necessary a performance, but it could by helpfull in where clause, group
by caluse or order by clause and some more reasons. Wherever you use
FULLNAME it's every where the same format !
Think about Computed by fields on a TIMESTAMP datatype to EXTRACT YEAR,
MONTH and DAY for example.

SELECT
*
FROM
EMPLOYEE
WHERE
FULL_NAME containing 'man'

Regards,
Arno