How can I define a composite primary key in SQL?
How can I define a composite primary key consisting of two fields in SQL? I am using PHP to create tables and everything. I want to make a table name voting with fields QuestionID , MemeberID , and vote . And the Composite primary key consists of the fields QuestionID and MemberID . How should I do this? Just for clarification: a table can have at most one primary key. A primary key consists of one or more columns (from that table). If a primary key consists of two or more columns it is called a composite primary key . It is defined as follows: CREATE TABLE voting ( QuestionID NUMERIC,