DROP TABLE
Description
This statement is used to delete a table from seekdb.
Syntax
DROP {TABLE | TABLES} [TEMPORARY] [IF EXISTS]
table_name [,table_name]...
[RESTRICT | CASCADE]
Parameters
| Parameter | Description |
|---|---|
| table_name | Specifies the name of the table to be deleted. When deleting multiple tables, separate the table names with commas. |
| TEMPORARY | Specifies that the table is a temporary table. |
| IF EXISTS | If you specify IF EXISTS, no error will be returned even if the table does not exist. If you do not specify this option, an error will be returned. |
| RESTRICT | CASCADE | Used in scenarios where tables are migrated from other databases to seekdb. Note This parameter is not supported in the current version. If specified, it will be parsed and ignored. |
Examples
-
Delete the
test1table by specifyingIF EXISTS.DROP TABLE IF EXISTS test1;
Query OK, 0 rows affected (0.001 sec) -
Delete the
test1andtest2tables by specifyingIF EXISTS.DROP TABLES IF EXISTS test1,test2;
Query OK, 0 rows affected (0.001 sec) -
Delete multiple tables without specifying
IF EXISTS. An error will be returned if any of the tables do not exist.DROP TABLES test1,test2;
ERROR 1051 (42S02): Unknown table 'test.test2' -
Delete the temporary table
tset3.DROP TEMPORARY TABLE test3;
Query OK, 0 rows affected (0.001 sec)