Constraints
CHECK
CREATE TABLE products (
product_no integer,
-- named column constraint
price numeric CONSTRAINT positive_price CHECK (price > 0),
-- column contraint
discounted_price numeric CHECK (discounted_price > 0),
-- table constraint as defined not within a column
CHECK (price > discounted_price),
-- this is also possible
CHECK (discounted_price > 0 AND price > discounted_price),
-- named table constraint
CONSTRAINT valid_discount CHECK (price > discounted_price)
);NOT NULL
UNIQUE
PRIMARY KEY
Foreign Keys
Last updated