## Column Definition (column_definition)

A column definition (column_definition) defines a column in a table. The name and data type of each column are defined by the column name (column name) and data type (data type). The column names must be unique within a base table.

### Syntax

<column_definition> ::= <column_name> <data_type> [<column_attributes>]
| <column_name> <domain_name> [<column_attributes>]

### Explanation

If the [PRIMARY] KEY column attribute (column_attributes) is specified, the CREATE TABLE statement must not contain a key definition.

A column definition may only consist of a column name (column name) if a QUERY expression (query expression) is used in the CREATE TABLE statement.

#### <domain_name>

If a column name and domain name (domain_name) (in other words, the name of a value range) are specified, the domain name must identify an existing domain. The data type and the length of the domain are assigned to the specified column. If the domain has a constraint_definition, the effect is the same as if the corresponding CONSTRAINT definition were specified in the column attribute of the column definition.

#### NOT NULL Columns

Columns, which are part of the key, or for which NOT NULL was defined, are called NOT NULL columns. A NULL value cannot be inserted in these columns.

● Mandatory columns: NOT NULL columns for which a DEFAULT specification has not been declared as a column attribute are called mandatory columns. Whenever rows are inserted, values must be sp ecified for these columns.

● Optional columns: columns that are not mandatory are referred to as optional columns. A value does not have to be specified when a row is inserted in these columns. If a DEFAULT specification exists for the column, the default value is entered in the column. If there is no DEFAULT specification, a NULL value is entered in the column.

See also:

Memory Requirements of a Column Value According to Data Type

Restrictions for SQL Statements