You can execute the DROP TABLE statement to delete a specified table.
Syntax
DROP TABLE [IF EXISTS] tbl_name;
Note If you execute the DROP TABLE statement to delete a table from a PolarDB-X instance, the corresponding physical tables are automatically deleted.
Precautions
- If tables that have a global secondary index are deleted, the corresponding base tables and the corresponding index tables are deleted.
- Do not execute this statement to delete only an index table. To delete an index, execute
the
ALTER TABLE DROP INDEX
statement. - The
DROP TABLE
statement can delete only one table in each execution. If you attempt to delete multiple tables at a time by executing the DROP TABLE statement, an error message is returned.
Example
You can execute the following statement to delete a table named user_log
:
DROP TABLE user_log;