This topic describes the syntax and usage of the DROP TABLE statement.
Syntax
DROP TABLE [ IF EXISTS ] table_name [, ...];
DROP TABLE supports dropping multiple tables in a single statement.
The following table describes the parameters.
|
Parameter |
Description |
|
IF EXISTS |
|
|
table_name |
The name of the table to drop. |
Example
The following statement drops a table named holo_test:
DROP TABLE holo_test;
Drop a table using HoloWeb
HoloWeb provides a visual interface to drop a table without writing SQL statements. Follow these steps:
-
Go to the HoloWeb console. Connect to HoloWeb to run queries.
-
In the top menu bar of the HoloWeb page, click Metadata Management.
-
On the Metadata Management page, in the Instances Connected list on the left, right-click the table to drop and select Delete Table.
-
In the Delete Table dialog box, click OK.
FAQ
-
Problem
The operation fails with the following error:
ERROR: cannot drop table xxx because other objects depend on it. Detail: view xxx depends on table xxx. Hint: Use DROP ... CASCADE to drop the dependent objects too.. -
Possible cause
The table cannot be dropped because a view depends on it.
-
Solution
Run the following statement to perform a cascade drop, which drops the table along with any dependent objects, such as views.
DROP TABLE [ IF EXISTS ] <table_name> [, ...] CASCADE;