statement

CREATE DOMAIN

Defines a reusable constrained type in PostgreSQL. A CHECK alone does not reject NULL. Example target: PostgreSQL 17. Use only the isolated starter dataset; setup and expected results are in the batch evidence.

Formal Syntax & Structure

sql syntaxsql
CREATE DOMAIN name AS type CHECK (condition)

Working Example

Example Snippetsql
CREATE DOMAIN positive_int AS INTEGER CHECK (VALUE > 0);
SQL Reference