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

后端 未结 5 1427
迷失自我
迷失自我 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:18

    It is mentioned as a synonym for INDEX in the 'create table' docs: MySQL 5.5 Reference Manual :: 13 SQL Statement Syntax :: 13.1 Data Definition Statements :: 13.1.17 CREATE TABLE Syntax

    Nos already cited the section and linked the help for 5.1.

    Like PRIMARY KEY creates a primary key and an index for you, KEY creates an index only.

提交回复
热议问题