Deleting a Table
Function
This statement is used to delete tables.
Syntax
1
|
DROP TABLE [IF EXISTS] [db_name.]table_name; |
Keywords
- If the table is stored in OBS, only the metadata is deleted. The data stored on OBS is not deleted.
- If the table is stored in DLI, the data and the corresponding metadata are all deleted.
Parameters
Parameter |
Description |
---|---|
db_name |
Database name, which consists of letters, digits, and underscores (_). The value cannot contain only digits or start with a digit or underscore (_). |
table_name |
Table name |
Precautions
The to-be-deleted table must exist in the current database. Otherwise, an error is reported. To avoid this error, add IF EXISTS to this statement.
Example
- Create a table. For details, see Creating an OBS Table or Creating a DLI Table.
- Run the following statement to delete table test from the current database:
1
DROP TABLE IF EXISTS test;
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.