mysql创建索引

使用create index创建

create index on tablename (columnname(限制长度))

使用alter table创建

ALTER TABLE tableName ADD INDEX indexName(columnName);

创建表时创建索引

CREATE TABLE tableName(
  id INT NOT NULL,
  columnName  columnType,
  INDEX [indexName] (columnName(length))
);
posted @ 2023-05-31 22:14  _DC  阅读(16)  评论(0编辑  收藏  举报