I' was wondering should my primary key look like this PRIMARY KEY (id, category_id, posts_id)
or look like this PRIMARY KEY (id)
?
Here is my MySQL table.
CREATE TABLE posts_categories (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
category_id INT UNSIGNED NOT NULL,
posts_id INT UNSIGNED NOT NULL,
date_created DATETIME NOT NULL,
PRIMARY KEY (id, category_id, posts_id),
UNIQUE KEY (category_id, posts_id)
);