在执行CREATE TABLE时创建索引

CREATE TABLE 'employee' (
'id' int(ll) NOT NULL,
'name' varchar(255) DEFAULT NULL,
'age' int(ll) DEFAULT NULL,
'date' datetime DEFAULT NULL,
'sex' int(l) DEFAULT NULL,
PRIMARY KEY ('id'),
KEY 'idx_name' ('name') USING BTREE
)ENGINE=InnoDB  DEFAULT CHARSET = utf8;
使用ALTER TABLE命令添加索引
ALTER TABLE table_name ADD INDEX index_name (column);
使用CREATE INDEX命令创建
CREATE INDEX index_name ON table_name(column);

Was this helpful?

0 / 0

发表回复 0

Your email address will not be published.