i am working on mysql server.where i have created a table, named question . column/attributes of this table are (course,subject,year,question) i want to create a primary key(or composite key) consists of (course+subject+year). i.e. for a particular course+subject+year combination there can be only one question.there will be only one row with the combination of (course+subject+year),creation of another row won't be possible. i have done it by :
primary key(course,subject,year);
but it's not working.still i can create two rows with same combination of course,subject,year.
can anyone tell me how can i create a composite key propery????
CREATE TABLE
statement, and some sample statements that you say created duplicate rows. – ConsolataSchema Creation Failed: Duplicate entry 'English-Composition-101' for key 'PRIMARY':
– Consolata