Specifying the unique column using Unique function : Unique « Constraints « PostgreSQL






Specifying the unique column using Unique function

postgres=#
postgres=# CREATE TABLE products (
postgres(#    product_no integer,
postgres(#    name text,
postgres(#    price numeric,
postgres(#    UNIQUE (product_no)
postgres(# );
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "products_product_no_key" for table "products"
CREATE TABLE
postgres=#
postgres=# drop table products;
DROP TABLE
postgres=#
postgres=#
postgres=#

           
       








Related examples in the same category

1.Unique Constraints
2.Unique constraint refers to a group of columns, the columns are listed separated by commas
3.Assign your own name for a unique constraint
4.Unique and not null column