You can use the DROP TABLE statement to delete a table.
Syntax
DROP [TEMPORARY] TABLE [IF EXISTS]
tbl_name [, tbl_name] ...
[RESTRICT | CASCADE]
Note The syntax that is used to delete aPolarDB-X PolarDB-X database table is the same as the syntax that is used to delete a MySQL
database table. The system automatically deletes the physical table that corresponds
to the deleted table at the same time. For more information, see DROP TABLE Statement.
Note
- When you delete a table that contains a global secondary index, the index table is deleted at the same time.
- You cannot use the DROP TABLE statement to delete an index table of a table. To delete an index, use the ALTER TABLE DROP INDEX statement.
Examples
Use the following statement to delete a table that is named user_log
:
DROP TABLE user_log;