What's the difference between using INDEX vs KEY in MySQL?

后端 未结 5 1407
迷失自我
迷失自我 2020-11-28 01:54

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 UN         


        
5条回答
  •  有刺的猬
    2020-11-28 02:30

    There's no difference. They are synonyms.

    From the CREATE TABLE manual entry:

    KEY is normally a synonym for INDEX. The key attribute PRIMARY KEY can also be specified as just KEY when given in a column definition. This was implemented for compatibility with other database systems.

提交回复
热议问题