DROP TABLE statement

Synopsis

DROP TABLE  [ IF EXISTS ] table_name

Syntax Diagram

Read syntax diagramSkip visual syntax diagramDROP TABLEIF EXISTStable_name

For information on reading syntax diagrams, see How to read syntax diagrams

Description

Drops an existing table.

The optional IF EXISTS clause causes the error to be suppressed if the table does not exist.

Examples

Drop the table orders_by_date:
DROP TABLE orders_by_date
Drop the table orders_by_date if it exists:
DROP TABLE IF EXISTS orders_by_date

Expected behavior

  • If you run a DROP TABLE query on external tables, only the metadata is deleted and the underlying data remains as is. For all external tables, you must explicitly delete the directory and the data.
  • If you run a DROP TABLE query on managed tables, the metadata and the underlying data are deleted.