Defining Composite Key with Auto Increment in MySQL
You can’t have MySQL do this for you automatically for InnoDB tables – you would need to use a trigger or procedure, or use another DB engine such as MyISAM. Auto incrementing can only be done for a single primary key. Something like the following should work DELIMITER $$ CREATE TRIGGER xxx BEFORE INSERT ON … Read more