首页 > 文章列表 > MySQL DROP 命令的用途是什么?

MySQL DROP 命令的用途是什么?

276 2023-09-10

顾名思义,它用于从数据库中完全删除表。

语法

Drop table table_name;

示例

mysql> Drop table Student;
Query OK, 0 rows affected (0.09 sec)

上面的查询从数据库中完全删除了“Student”表。我们可以观察到 MySQL 在运行以下查询后返回一条错误消息 -

mysql> Select * from Student;
ERROR 1146 (42S02): Table 'query.student' doesn't exist