Description
This statement is used to drop a table from OceanSeek.
Syntax
DROP {TABLE | TABLES} [TEMPORARY] [IF EXISTS]
table_name [,table_name]...
[RESTRICT | CASCADE]
Parameters
Parameters |
Description |
|---|---|
| table_name | Specify the table name to be dropped. When dropping multiple tables, separate them with commas (,). |
| TEMPORARY | Indicates that a temporary table is dropped. |
| IF EXISTS | If specified IF EXISTS. If this parameter is not specified, an error will be returned. |
| RESTRICT \ | CASCADE | Used for scenarios where data is migrated from other databases to OceanSeek. Note This parameter is not supported in the current version. If provided, it will be parsed but ignored. |
Examples
Specify
IF EXISTSto drop the tabletest1.obclient> DROP TABLE IF EXISTS test1; Query OK, 0 rows affectedSpecify
IF EXISTSto delete both tablestest1andtest2.obclient> DROP TABLES IF EXISTS test1,test2; Query OK, 0 rows affectedIf
IF EXISTSis not specified, deleting multiple tables will fail if any one of the tables does not exist.obclient> DROP TABLES test1,test2; ERROR 1051 (42S02): Unknown table 'test.test2'Drop the temporary table
tset3.obclient> DROP TEMPORARY TABLE test3; Query OK, 0 rows affected