DROP [TEMPORARY] TABLE [IF EXISTS]
tbl_name] ... [RESTRICT | CASCADE]
DROP TABLE removes one or more
tables. You must have the
privilege for each table. All table data and the table definition
are removed, so be
careful with this statement! If any of the tables named
in the argument list do not exist, MySQL returns an error
indicating by name which nonexisting tables it was unable to drop,
but it also drops all of the tables in the list that do exist.
When a table is dropped, user privileges on the table are
not automatically dropped. See
Section 184.108.40.206, “
In MySQL 3.22 or later, you can use the keywords
EXISTS to prevent an error from occurring for tables
that do not exist. As of MySQL 4.1, a
generated for each nonexistent table when using
EXISTS. See Section 220.127.116.11, “
SHOW WARNINGS Syntax”.
permitted to make porting easier. In MySQL 4.1 and
earlier, they do nothing.
DROP TABLE automatically commits
the current active transaction, unless you are using MySQL 4.1
or higher and the
TEMPORARY keyword is ignored in MySQL 4.0.
As of 4.1, it has the following effect:
The statement drops only
The statement does not end an ongoing transaction.
No access rights are checked. (A
table is visible only to the session that created it, so no
check is necessary.)
TEMPORARY is a good way to ensure that
you do not accidentally drop a non-