Sometimes, you want an auto_increment column on a table, but you really don't need an index starting with the column. MySQL doesn't swing that way, so we're left to improvise. Say this is our table:
CREATE TABLE user_things (
user_id INT NOT NULL,
thing_index INT NOT NULL,
PRIMARY KEY(user_id, thing_index)
) ENGINE=InnoDBWhat we'd
(
Read more... )