我知道如何在下面的代码中使用索引.我知道如何使用foreign key和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,
date_completed TIMESTAMP,
PRIMARY KEY (task_id),
INDEX parent (parent_id),
....
...
KEY order_date (order_date)
...
The only difference I see is that when I use KEY ...
, I need to repeat the word, e.g.
KEY order_date (order_date)
.