+ -
当前位置:首页 → 问答吧 → mysql中创建索引

mysql中创建索引

时间:2011-07-04

来源:互联网

我需要创建一个索引,但是需要判断此索引是否存在,存在则删除之后在创建。
请问下这个sql语句应该怎么写~

作者: zeroth123   发布时间: 2011-07-04

SQL code

create index xxx on tb(col,col2)

作者: jinfengyiye   发布时间: 2011-07-04

SQL code

mysql> if exists(select 1 from information_schema.statistics where table_schema=
'db' and table_name='tbName' and index_name='ix_name') drop index ix_name;


索引一般不删除再建!

作者: jinfengyiye   发布时间: 2011-07-04

相关阅读 更多

热门下载

更多