FirebirdSQL logo

INCREMENT Option

The optional INCREMENT clause allows you to specify another non-zero step value than 1.

Warning

The SQL standard specifies that if INCREMENT is specified with a negative value, and START WITH is not specified, that the first value generated should be the maximum of the column type (e.g. 231 - 1 for INTEGER).Instead, Firebird will start at 1.

Computed Columns

Computed columns can be defined with the COMPUTED [BY] or GENERATED ALWAYS AS clause (the SQL standard alternative to COMPUTED [BY]).Specifying the data type is optional;if not specified, the appropriate type will be derived from the expression.

If the data type is explicitly specified for a calculated field, the calculation result is converted to the specified type.This means, for instance, that the result of a numeric expression could be converted to a string.

In a query that selects a computed column, the expression is evaluated for each row of the selected data.

Tip

Instead of a computed column, in some cases it makes sense to use a regular column whose value is calculated in triggers for adding and updating data.It may reduce the performance of inserting/updating records, but it will increase the performance of data selection.