## CREATE DOMAIN Statement (create_domain_statement)

A CREATE DOMAIN statement (create_domain_statement) defines a value range (domain).

### Syntax

<create_domain_statement> ::= CREATE DOMAIN <domain_name> <data_type> [<default_spec>] [<constraint_definition>]

### Examples

SQL Tutorial, Domains

### Explanation

The CONSTRAINT definition (constraint_definition) must not contain a constraint name.

The CREATE DOMAIN statement can be executed by all database administrators.

If the domain name is specified without the schema name, the schema with the name of the current user is assigned to the range. If you specify the domain name with a schema, the schema name must be the same as the name of the current user. In this case, the current user becomes the owner of the domain.

The name of the domain must be different from all other domain names of the current user.

If a domain is generated with a CONSTRAINT definition, the domain name is included in the search condition as a column name.