MogDB
Ecological Tools
Doc Menu

DROP TABLE

Function

DROP TABLE deletes a table.

Precautions

  • DROP TABLE forcibly deletes the specified table and the indexes depending on the table. After the table is deleted, the functions and stored procedures that need to use this table cannot be executed. Deleting a partitioned table also deletes all partitions in the table.
  • Only the table owner or a user granted with the DROP permission can run the DROP TABLE command. The system administrator has this permission by default.

Syntax

DropTable ::= DROP TABLE [ IF EXISTS ] 
    { [schema'.']table_name } [, ...] [ CASCADE | RESTRICT ];

Parameter Description

  • 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 name of the table to be deleted.

  • CASCADE | RESTRICT

    • CASCADE: automatically deletes the objects (such as views) that depend on the table.
    • RESTRICT: refuses to delete the table if any objects depend on it. This is the default action.

Examples

See Example in CREATE TABLE.