DOMAIN | DATATYPE clause
It is recommended that you use CREATE DOMAIN, rather than CREATE DATATYPE, because CREATE DOMAIN is defined in the SQL/2008
standard.

NULL clause
This clause allows you to specify the nullability of a domain. When a domain is used to define a column, nullability
is determined as follows:

Nullability specified in the column definition.

Nullability specified in the domain definition.

If the nullability was not explicitly specified in either the column definition or the domain definition, then the setting
of the allow_nulls_by_default option is used.

CHECK clause
When creating a domain with a CHECK constraint, you can use a variable name prefixed with the @ sign in the CHECK constraint's
search condition. When the data type is used in the definition of a column, such a variable is replaced by the column name.
This allows a domain's CHECK constraint to be applied to each table column defined with that domain.

Domains are aliases for built-in data types, including precision and scale values where applicable. They improve convenience
and encourage consistency in the database.

Domains are objects within the database. Their names must conform to the rules for identifiers. Domain names are always case
insensitive, as are built-in data type names.

The user who creates a data type is automatically made the owner of that data type. No owner can be specified in the CREATE
DATATYPE statement. The domain name must be unique, and all users can access the data type without using the owner as prefix.

Domains can have CHECK conditions and DEFAULT values, and you can indicate whether the data type permits NULL values or not.
These conditions and values are inherited by any column defined on the domain. Any conditions or values explicitly specified
in the column definition override those specified for the domain.

To drop the domain from the database, use the DROP DOMAIN statement. You must be either the owner of the domain, or have DBA
authority, to drop a domain.

The following statement creates a domain named address, which holds a 35-character string, and which may be NULL.

CREATE DOMAIN address CHAR( 35 ) NULL;

The following statement creates a domain named ID, which does not allow NULLS, and which is autoincremented by default.

CREATE DOMAIN ID INT
NOT NULL
DEFAULT AUTOINCREMENT;

The following statement creates a domain named PhoneNumber, which uses a regular expression within a CHECK constraint to ensure
that the string has a properly-formatted North American phone number of 12 characters, consisting of a 3-digit area code,
3-digit exchange, and 4-digit number separated by either dashes or a blank.