Can SQL table have multiple columns with primary key? [duplicate]

A table can have just one primary key constraint, but that may be comprised of several columns e.g.

create table my_table (col1 integer, col2 integer, col3 integer,
   primary key (col1, col2, col3)
   );

In addition to the primary key, a table may also have one or more UNIQUE constraints, e.g.

create table my_table2 (col1 integer, col2 integer, col3 integer,
   primary key (col1, col2),
   unique (col2, col3)
   );

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)