Pretty basic stuff here, but for some reason it seems to be failing me. I have a lookup table that consists of two columns. Both columns should make up the primary key.
So the syntax for a composite key is simple enough, and I would have thought that this would have done it.
CREATE TABLE jmc_userpermissions (
userpermissions_permissionid int NOT NULL,
userpermissions_username varchar(55) NOT NULL,
PRIMARY KEY (userpermissions_permissionid,userpermissions_username)
)
Now the problem comes in when I try to populate.
INSERT INTO jmc_userpermissions ( userpermissions_permissionid, userpermissions_username ) VALUES ( 'updatecontact', 'angel' );
INSERT INTO jmc_userpermissions ( userpermissions_permissionid, userpermissions_username ) VALUES ( 'updateqty', 'angel' );
The second statement returns the error:
Could not insert updateqty for angel into jmc_userpermissions
Duplicate entry '0-angel' for key 'PRIMARY'