Updated on 2025-02-27 GMT+08:00

DROP TABLE

Description

Drops a table.

Precautions

  • DROP TABLE forcibly drops the specified table and the indexes depending on the table. After the table is dropped, the functions and stored procedures that need to use this table cannot be executed. Dropping a partitioned table also drops all partitions in the table.
  • The owner of a table, the owner of the schema of the table, users granted with the DROP permission on the table, or users granted with the DROP ANY TABLE permission can drop the specified table. System administrators have the permission to drop the specified table by default.

Syntax

DROP TABLE [ IF EXISTS ] 
    { [schema.]table_name } [, ...] [ CASCADE | RESTRICT ] [ PURGE ];

Parameters

  • IF EXISTS

    Reports a notice instead of an error if the specified table does not exist.

  • schema

    Specifies the schema name.

  • table_name

    Specifies the table name.

  • CASCADE | RESTRICT
    • CASCADE: The objects that depend on the table, such as views, triggers, and indexes, can be dropped cascadingly. Note that joined table objects cannot be dropped cascadingly.
    • RESTRICT: refuses to drop the table if any objects depend on it. This is the default action.
  • PURGE

    Specifies that even if the recycle bin function is enabled, the table is physically dropped instead of being moved to the recycle bin.

Examples

See Examples in "CREATE TABLE."

Helpful Links

ALTER TABLE and CREATE TABLE