Primary key for multiple column in PostgreSQL?
问题 How to provide primary key for multiple column in a single table using PostgreSQL? Example: Create table "Test" ( "SlNo" int not null primary key, "EmpID" int not null, /* Want to become primary key */ "Empname" varchar(50) null, "EmpAddress" varchar(50) null ); Note: I want to make "EmpID" also a primary key. 回答1: There can only be one primary key per table. That's what the word "primary" hints at. You can have additional UNIQUE columns. CREATE TABLE test( sl_no int PRIMARY KEY, -- NOT NULL