发布时间:2024-04-04 15:30:01
不需要使用某个数据表时,您可以将它删除。SQL DROP TABLE 语句用来删除数据表,以及与该表相关的所有数据、索引、触发器、约束和权限。DROP TABLE table_name;
table_name 表示要删除的数据表的名字。SQL> DESC website; +---------+---------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+---------------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(20) | NO | | NULL | | | url | varchar(30) | YES | | | | | age | tinyint(3) unsigned | NO | | NULL | | | alexa | int(10) unsigned | NO | | NULL | | | uv | float | YES | | 0 | | | country | char(3) | NO | | | | +---------+---------------------+------+-----+---------+----------------+ 7 rows in set (0.00 sec)这意味着 website 表是有效的,接着我们使用如下的代码将它删除:
SQL> DROP TABLE website;
Query OK, 0 rows affected (0.01 sec)
SQL> DESC website;
ERROR 1146 (42S02): Table 'test.website' doesn't exist
Copyright © 2009-2023 www.365tools.cn All Rights Reserved. 365工具网 版权所有 赣ICP备2023013700号-2