赞
踩
CREATE INDEX index_name ON table(column(length));
ALTER TABLE table_name ADD INDEX index_name ON (column(length));
CREATE TABLE `table` (
`id` int(11) NOT NULL AUTO_INCREMENT ,
`title` char(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
`time` int(10) NULL DEFAULT NULL ,
PRIMARY KEY (`id`), //主键索引
INDEX index_name (title(length)) //普通索引
);
CREATE UNIQUE INDEX index_name ON table(column(length));
ALTER TABLE table_name ADD UNIQUE INDEX index_name ON (column(length));
CREATE TABLE `table` (
`id` int(11) NOT NULL AUTO_INCREMENT ,
`title` char(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
`time` int(10) NULL DEFAULT NULL ,
PRIMARY KEY (`id`),
UNIQUE indexName (title(length))
);
ALTER TABLE article ADD INDEX index_titme_time (title(50),time(10));
ALTER TABLE `table_name` ADD INDEX index_name ( `column1`, `column2`, `column3` );
ALTER TABLE `table_name` ADD FULLTEXT ( `column`);
ALTER TABLE `table_name` ADD PRIMARY KEY ( `column` );
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。