13.1.8. DROP TABLE
Syntax
DROP [TEMPORARY] TABLE [IF EXISTS]
tbl_name
[, tbl_name
] ...
[RESTRICT | CASCADE]
DROP TABLE
removes one or more tables. You
must have the DROP
privilege for each table.
All table data and the table definition are
removed, so be careful
with this statement!
Note that for a partitioned table, DROP TABLE
permanently removes the table definition, all of its partitions,
and all of the data which was stored in those partitions. It
also removes the partitioning definition
(.par
) file associated with the dropped
table.
Use IF EXISTS
to prevent an error from
occurring for tables that do not exist. A
NOTE
is generated for each non-existent table
when using IF EXISTS
. See
Section 13.5.4.28, “SHOW WARNINGS
Syntax”.
RESTRICT
and CASCADE
are
allowed to make porting easier. For the moment, they do nothing.
Note: DROP
TABLE
automatically commits the current active
transaction, unless you use the TEMPORARY
keyword.
The TEMPORARY
keyword has the following
effects:
The statement drops only TEMPORARY
tables.
The statement does not end an ongoing transaction.
No access rights are checked. (A
TEMPORARY
table is visible only to the
client that created it, so no check is necessary.)
Using TEMPORARY
is a good way to ensure that
you do not accidentally drop a non-TEMPORARY
table.