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? 回答1: 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