表 test2
mysql> desc test2;
+-------+-------------+------+-----+---------+-------+
| Field | Type        | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| a1    | varchar(20) | YES  | MUL | NULL    |       |
| a2    | varchar(20) | YES  |     | NULL    |       |
| a3    | varchar(20) | YES  |     | NULL    |       |
| a4    | varchar(20) | YES  |     | NULL    |       |
| a5    | varchar(20) | YES  |     | NULL    |       |
| a6    | varchar(20) | YES  |     | NULL    |       |
+-------+-------------+------+-----+---------+-------+创建索引:mysql> create index inx_a on test2(a1);
Query OK, 3 rows affected (0.02 sec)
Records: 3  Duplicates: 0  Warnings: 0没有问题我在创建非聚集索引时用如下命令:
create nonclustered index id_a on test2(a2);报错:mysql> create nonclustered index id_a on test2(a2);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'nonclustered index id_a on test2(a2)' at line 1
哪点写错了呀??谢谢回答!

解决方案 »

  1.   

    上面那个写错了:create nonclustered index id_b on test2(a2);也同样报错:ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'nonclustered index id_b on test2(a2)' at line 1
      

  2.   

    MYSQL中没有这个概念, 所以也不进行这种控制。MYISAM根本就没有 聚集索引
    INNODB,主键就是 聚集索引,你也无法修改
      

  3.   

    mysql的索引没有聚集非聚集的概念哦...
    mysql索引分类:http://longxzq-126-com.javaeye.com/blog/591273