I was wondering how should my categories mysql table look like and which INDEX or KEY is correct or are all four correct?
INDEX (parent_id)
INDEX parent (parent_id)
INDEX parent_id (parent_id)
KEY parent_id (parent_id)
Here is my MySQL code.
CREATE TABLE categories (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
parent_id INT UNSIGNED NOT NULL DEFAULT 0,
category VARCHAR(255) NOT NULL,
url VARCHAR(255) NOT NULL,
depth INT NOT NULL DEFAULT 0,
PRIMARY KEY (id),
INDEX parent (parent_id),
UNIQUE KEY (parent_id, url)
);