开发者社区> 问答> 正文

怎样删除索引?

请具体说明。

展开
收起
游客vqgchj4kfdzsu 2021-10-14 22:37:10 801 0
2 条回答
写回答
取消 提交回答
  • mysql> show index from books;
    +-------+------------+------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
    | Table | Non_unique | Key_name         | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
    +-------+------------+------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
    | books |          0 | name             |            1 | name        | A         |           1 |     NULL | NULL   | YES  | BTREE      |         |               |
    | books |          1 | books_index_name |            1 | name        | A         |           1 |     NULL | NULL   | YES  | BTREE      |         |               |
    | books |          1 | books_index_name |            2 | author      | A         |           1 |     NULL | NULL   | YES  | BTREE      |         |               |
    +-------+------------+------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
    3 rows in set (0.00 sec)
    
    mysql> drop index name on books;
    Query OK, 0 rows affected (0.08 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    
    2021-10-15 07:26:05
    赞同 展开评论 打赏
  • DROP INDEX 索引名 ON 表名;

    2021-10-14 22:38:16
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载