从MySQL表中删除索引
要从MySQL表中删除索引,语法如下-
alter table yourTableName drop index `yourIndexName`;
让我们首先创建一个表-
Mysql> create table DemoTable1469 -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentName varchar(40), -> StudentAge int -> );
以下是在列名上添加索引的查询-
mysql> create index `Student Name_Index` on DemoTable1469(StudentName); Records: 0 Duplicates: 0 Warnings: 0
让我们检查表说明-
mysql> desc DemoTable1469;
这将产生以下输出-
+-------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+----------------+ | StudentId | int(11) | NO | PRI | NULL | auto_increment | | StudentName | varchar(40) | YES | MUL | NULL | | | StudentAge | int(11) | YES | | NULL | | +-------------+-------------+------+-----+---------+----------------+ 3 rows in set (0.00 sec)
以下是删除索引的查询-
mysql> alter table DemoTable1469 drop index `Student Name_Index`; Records: 0 Duplicates: 0 Warnings: 0
让我们再次检查表描述-
mysql> desc DemoTable1469;
这将产生以下输出-
+-------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+----------------+ | StudentId | int(11) | NO | PRI | NULL | auto_increment | | StudentName | varchar(40) | YES | | NULL | | | StudentAge | int(11) | YES | | NULL | | +-------------+-------------+------+-----+---------+----------------+ 3 rows in set (0.00 sec)
热门推荐
1 带狗狗训练
4 听力训练狗狗
6 怎训练狗狗
7 腹肌训练狗狗
8 网球训练狗狗
9 记叙文训练狗狗
10 狗狗太凶怎么训练
11 核心力量训练狗狗
12 狗狗乱叫怎么训练
13 发音训练狗狗
14 怎么训练狗狗叼东西给主人
15 荆州训练狗狗
16 篮球训练狗狗
17 做训练狗狗
18 训练狗狗坐姿