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.

Syntax

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.

Helpful Links

ALTER TABLE and CREATE TABLE

Feedback
编组 3备份
    openGauss 2025-04-30 22:42:17
    cancel