Table / for city
-- ----------------------------
DROP TABLE IF EXISTS city
;
CREATE TABLE city
(id
int(11) NOT NULL AUTO_INCREMENT,country
varchar(255) DEFAULT NULL,name
varchar(255) DEFAULT NULL,state
varchar(255) DEFAULT NULL,code_name
varchar(255) DEFAULT NULL,
PRIMARY KEY (id
),
KEY index_id
(id
) USING BTREE,
KEY index_name
(name
),
KEY index_mass
(country
,name
),
FULLTEXT KEY country
(country
)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
普通索引
ALTER TABLE city ADD INDEX index_name (name);
主键索引
ALTER TABLE city ADD PRIMARY KEY (id);
全文索引
ALTER TABLE city ADD FULLTEXT (country);
多列索引
ALTER TABLE city ADD INDEX index_mass (country,name);