On Wednesday, January 2, 2019, Rich Shepard <rshep...@appl-ecosys.com>
wrote:

>
> CREATE DOMAIN state_code AS char(2)
> DEFAULT '??'
> CONSTRAINT valid_state_code
> CHECK (value IN ('AL', 'AK', 'AZ', ...));
>
> This applies to all tables each having a column named state_code.
>

There is no magic name logic involved.  A domain is just a type with
inherent constraints that are user definable.  You make use of it like any
other type.

Create table tbl (
column_name state_code not null
)

Values stored in column_name are now of type state_code and constrained to
be one of the check constraint values.

David J.

Reply via email to