DROP TABLE
DROP TABLE removes an existing table.
Synopsis
Section titled “Synopsis”DROP TABLE [IF EXISTS] table_nameDescription
Section titled “Description”The command removes the relation, its rows and table-local index metadata. IF EXISTS suppresses the missing-object error only.
Parameters
Section titled “Parameters”table_name is an unqualified table name in the current catalog namespace.
Result
Section titled “Result”Success returns a command result with no rows. IF EXISTS also succeeds when no matching table exists.
Transaction behavior
Section titled “Transaction behavior”DROP TABLE is transactional. Until commit, other sessions retain their valid committed view; ROLLBACK preserves the table.
Errors and limitations
Section titled “Errors and limitations”Without IF EXISTS, a missing table is an error. Dependencies and referential constraints can prevent removal. The command does not delete another database or unrelated files.
Privileges
Section titled “Privileges”The effective Principal must own the table; the session also needs CONNECT.
Example
Section titled “Example”CREATE TABLE ref_drop_table (id INTEGER PRIMARY KEY);DROP TABLE ref_drop_table;SHOW TABLES;See also
Section titled “See also”See Defining a Schema, CREATE TABLE and ROLLBACK.