Skip to main content

DROP TABLE

Removes a table from your data source.

When dropping an Apache Iceberg table:

  • For external Nessie data sources, the DROP TABLE command logically removes a table from the source. Even though the table is removed from the catalog, it still physically exists in storage until garbage collection removes it.
  • For Amazon S3 data sources, the DROP TABLE command logically removes a table from the source and physically removes all files associated with the table. After the table is dropped, it is permanently deleted and cannot be restored.
  • For AWS Glue data sources, the DROP TABLE command removes a table from the catalog. The data files are not deleted from the warehouse.
Syntax
DROP TABLE [ IF EXISTS ] <table_name>
[ AT { REF[ERENCE] | BRANCH } <reference_name> ]

Parameters

[ IF EXISTS ] Optional

When included, the command will succeed regardless of whether the table existed. If this clause is not specified, the command will fail if the table to be dropped does not exist.


<table_name> String

The name of the table that you want to drop.


AT { REF[ERENCE] | BRANCH } <reference_name> String   Optional

Specifies the reference at which you want to drop the table from. When this parameter is omitted, the current reference is used.

  • REF: Identifies the specific reference.
  • BRANCH: Identifies the specific branch.

Example

Drop table
DROP TABLE demo.example_table
Drop table at branch
DROP TABLE Persons AT BRANCH main