Purpose
You can use this statement to drop tables from OceanBase Database.
Syntax
DROP {TABLE | TABLES} [IF EXISTS]
table_name [,table_name]...
[RESTRICT | CASCADE]
Parameters
| Parameter | Description |
|---|---|
| table_name | The name of the table to be dropped. Multiple table names must be separated with commas (,). |
| IF EXISTS | If IF EXISTS is specified, no error is returned even if the table to be dropped does not exist. Otherwise, an error is returned. |
| RESTRICT | CASCADE | This parameter is applicable when you migrate data from other databases to OceanBase Database. Note The current version does not support this parameter. If this parameter is specified, it will be parsed and ignored. |
Examples
Drop the
test1table withIF EXISTSspecified.obclient> DROP TABLE IF EXISTS test1; Query OK, 0 rows affectedDrop tables
test1andtest2withIF EXISTSspecified.obclient> DROP TABLES IF EXISTS test1,test2; Query OK, 0 rows affectedDrop multiple tables without specifying
IF EXISTS. If a table does not exist, an error is returned.obclient> DROP TABLES test1,test2; ERROR 1051 (42S02): Unknown table 'test.test2'