Unique constraint refers to a group of columns, the columns are listed separated by commas : Unique « Constraints « PostgreSQL






Unique constraint refers to a group of columns, the columns are listed separated by commas


postgres=#
postgres=#
postgres=# -- Unique constraint refers to a group of columns, the columns are listed separated by commas:
postgres=#
postgres=# CREATE TABLE example (
postgres(#    a integer,
postgres(#    b integer,
postgres(#    c integer,
postgres(#    UNIQUE (a, c)
postgres(# );
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "example_a_key" for table "example"
CREATE TABLE
postgres=#
postgres=# drop table example;
DROP TABLE
postgres=#
           
       








Related examples in the same category

1.Unique Constraints
2.Specifying the unique column using Unique function
3.Assign your own name for a unique constraint
4.Unique and not null column