删除表

MySQL从小白到总裁完整教程目录:https://blog.csdn.net/weixin_67859959/article/details/129334507?spm=1001.2014.3001.5502

语法格式:

drop table 表名;

说明:连同表结构、表中的数据都删除

案例:删除test03表,并验证  

mysql> desc test03;
+---------+-------------+------+-----+---------+-------+
| Field   | Type        | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| name    | varchar(30) | YES  |     | NULL    |       |
| age     | int(3)      | YES  |     | NULL    |       |
| salary  | double(8,2) | YES  |     | NULL    |       |
| etime   | date        | YES  |     | NULL    |       |
| address | varchar(50) | YES  |     | NULL    |       |
+---------+-------------+------+-----+---------+-------+
5 rows in set (0.04 sec)

mysql> drop table test03;
Query OK, 0 rows affected (0.01 sec)

mysql> desc test03;
ERROR 1146 (42S02): Table 'czwbkl.test03' doesn't exist

删除表_第1张图片

练习:删除work01表,并验证  

mysql> desc work01;
+---------+-------------+------+-----+---------+-------+
| Field   | Type        | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| wid     | int(11)     | YES  |     | NULL    |       |
| wname   | varchar(30) | YES  |     | NULL    |       |
| gender  | char(3)     | YES  |     | NULL    |       |
| score   | double(4,1) | YES  |     | NULL    |       |
| wtime   | date        | YES  |     | NULL    |       |
| address | varchar(50) | YES  |     | NULL    |       |
+---------+-------------+------+-----+---------+-------+
6 rows in set (0.02 sec)

mysql> drop table work01;
Query OK, 0 rows affected (0.00 sec)

mysql> show tables;
+------------------+
| Tables_in_czwbkl |
+------------------+
| test01           |
| test02           |
+------------------+
2 rows in set (0.00 sec)

删除表_第2张图片

你可能感兴趣的:(android)