Domains can be used to define an alias for a data type so that the same definition can be used throughout the database.
create domain positive_number
as numeric(12,5) not null
check (value > 0);
create table orders
(
order_id integer not null primary key,
customer_id integer not null references customers,
amount positive_number
);
create table employee
(
employee_id integer not null references customers,
lastname varchar(100) not null,
firstname varchar(100),
salary positive_number
);
Back to the SQL Feature Comparison