Updated on 2025-04-21 GMT+08:00

DROP TABLE

Function

This command is used to delete an existing table.

Syntax

DROP TABLE [IF EXISTS] [db_name.]table_name;

Parameter Description

Table 1 Parameter descriptions

Parameter

Description

db_name

Database name. If this parameter is not specified, the current database is selected.

table_name

Name of the table to be deleted.

Caveats

  • In this command, IF EXISTS and db_name are optional.
  • When this statement is used to drop a foreign table, the data in the OBS directory is not automatically deleted.
  • When deleting an MOR table, the tables with the _rt and _ro suffixes are not automatically deleted. To delete them, you need to execute a DROP statement separately.

Example

DROP TABLE IF EXISTS hudidb.h1;

Permission Requirements

Metadata service provided by DLI

  • SQL permissions:

    database

    table

    DROP_TABLE

    None

  • Fine-grained permission: dli:table:dropTable

Metadata services provided by LakeFormation. Refer to the LakeFormation documentation for details on permission configuration.

System Response

The table will be deleted.