Is the proper way to use the UNIQUE KEY
in my MySQL table?
MySQL data.
id pid aid
1 2 3
2 3 2
3 3 4
MySQL table.
CREATE TABLE ab (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
pid INT UNSIGNED NOT NULL DEFAULT 0,
aid INT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (id),
UNIQUE KEY (pid, aid)
);