SQL$HELP_OLD72.HLB  —  CREATE  TABLE  Arguments  COMPUTED_BY
    Specifies that the value of this column is calculated from values
    in other columns and constant expressions.

    If your column definition refers to a column name within a value
    expression, that named column must already be defined within the
    same CREATE TABLE statement. See the Value_Expressions HELP topic
    for information on value expressions.

    Any column that you refer to in the definition of a computed
    column cannot be deleted from that table unless you first delete
    the computed column.

    SQL does not allow the following for computed columns:

    o  UNIQUE constraints

    o  REFERENCES clauses

    o  PRIMARY KEY constraints

    o  DEFAULT clause

    o  IDENTITY clause

    o  Default value for DATATRIEVE

    For example, if the FICA_RATE for an employee is 6.10 percent of
    the employee's starting salary and the group insurance rate is
    0.7 percent, you can define FICA_RATE and GROUP_RATE columns like
    this:

    SQL> CREATE TABLE payroll_detail
    cont> (salary_code CHAR(1),
    cont>  starting_salary SMALLINT(2),
    cont>  fica_amt
    cont>    COMPUTED BY (starting_salary * 0.061),
    cont>  group_rate
    cont>    COMPUTED BY (starting_salary * 0.007));

    When you use this type of definition, you only have to store
    values in the salary_code and starting_salary columns. The FICA
    and group insurance deduction columns are computed automatically
    when the columns fica_amt or group_rate are selected.
Close Help