Features
The DROP TABLE
command is used to delete a table in the database. Please note that after performing this operation, the table and data will be deleted. If you want to recover it, please use the UNDROP command, and ensure that the deleted object is within the TIME TRAVEL retention period, otherwise it cannot be recovered.
Syntax
Parameter Description
IF EXISTS
: Optional, if the specified table does not exist, the system will not report an error.schema_name
: Optional, specifies the name of the schema. If not specified, the current user's schema is used by default.table_name
: The name of the table to be deleted.
Example
- Delete the table named
my_table
under the current schema:
- Delete the
my_table
table under themy_schema
schema:
Precautions
- Please ensure that you have backed up the data in the table before executing the
DROP TABLE
command to prevent data loss. - Before deleting the table, make sure that the table is no longer referenced by other database objects (such as views, TABLE STREAM, etc.), otherwise it may cause errors.