You can execute a DROP TABLE statement to delete a table.
Syntax
DROP TABLE [IF EXISTS] tbl_name;
Note If you delete a table from a PolarDB-X instance by executing a DROP TABLE statement, the corresponding physical table is
automatically deleted.
Usage notes
- If you execute this statement to delete a table that uses global secondary indexes, the base table and the index tables are all deleted.
- Do not execute this statement to delete only index tables. To delete only index tables,
execute the
ALTER TABLE DROP INDEX
statement. - The
DROP TABLE
statement can delete only one table per execution. If you try to delete multiple tables by executing a DROP TABLE statement, an error is returned.
Examples
You can execute the following statement to delete a table named user_log
:
DROP TABLE user_log;