Description
The DROP TABLE
command is used to remove a table from the database. In Lakehouse, using DROP TABLE
can delete external tables. This operation does not delete the actual data in the table, only the metadata objects in the Lakehouse.
Syntax
Parameter Description
- IF EXISTS: (Optional) If the specified table does not exist, using this option can prevent the system from throwing an error.
- schema_name: (Optional) Specifies the schema name of the table to be deleted. If not specified, the current user's schema will be used by default.
- table_name: The name of the table to be deleted.
Example
- Delete a table under the current schema:
- Delete the table, no error if it does not exist:
- Delete tables under a specific schema:
- Delete tables under a specific schema without reporting an error if they do not exist: