Mega Code Archive

 
Categories / PostgreSQL / Constraints
 

Specifying range check in table creation

postgres=# postgres=# postgres=# CREATE TABLE products ( postgres(#    product_no integer, postgres(#    name text, postgres(#    price numeric CHECK (price > 0) postgres(# ); CREATE TABLE postgres=# postgres=# postgres=# drop table products; DROP TABLE postgres=#