I know how to use INDEX as in the following code. And I know how to use foreign key and primary key.
CREATE TABLE tasks (
task_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
parent_id INT UNSIGNED NOT NULL DEFAULT 0,
task VARCHAR(100) NOT NULL,
date_added TIMESTAMP NOT NULL,
PRIMARY KEY (task_id),
INDEX parent (parent_id),
KEY order_date (order_date)
There's no difference. They are synonyms.
KEYis normally a synonym for
INDEX. The key attribute
PRIMARY KEYcan also be specified as just
KEYwhen given in a column definition. This was implemented for compatibility with other database systems.