Primary keys constrains more than one column : Primary Key « Constraints « PostgreSQL






Primary keys constrains more than one column


postgres=#
postgres=# -- Primary keys constrains more than one column
postgres=#
postgres=# CREATE TABLE example (
postgres(#    a integer,
postgres(#    b integer,
postgres(#    c integer,
postgres(#    PRIMARY KEY (a, c)
postgres(# );
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "example_pkey" for table "example"
CREATE TABLE
postgres=#
postgres=# drop table example;
DROP TABLE
postgres=#
postgres=#
           
       








Related examples in the same category

1.Implicit index is created when creating a table for a primary key
2.Indicate one column as the primary key column
3.PRIMARY KEY will create implicit index
4.Primary key with check option
5.Add PRIMARY KEY in table creation
6.Use sequence value as a primary key