You can execute the DROP TABLE statement to delete a table. This topic describes how to use the DROP TABLE statement to delete a table.

Syntax

DROP TABLE [ IF EXISTS ] table_name [, ...];
Note You can execute the DROP TABLE statement to delete multiple tables at a time.
The following table describes the parameters in the statement.
Parameter Description
IF EXISTS
  • If you include the IF EXISTS clause in the statement, a success response is returned regardless of whether the specified table exists.
  • If you do not include the IF EXISTS clause in the statement, the following error is returned when the specified table does not exist: ERROR: table "non_exist_table" does not exist.
table_name The name of the table that you want to delete.

Example

The following example shows you how to use the DROP TABLE statement to delete a table:
DROP TABLE holo_test;

Use HoloWeb to visually delete a table

You can use HoloWeb to visually delete a table without the need to write SQL statements. To do so, perform the following steps:

  1. Go to the HoloWeb console. For more information, see HoloWeb quick start.
  2. In the top navigation bar of the HoloWeb console, click Metadata Management.
  3. Go to the Metadata Management page of the HoloWeb console. In the left-side Instance Management pane, right-click the table that you want to delete in the Instances Connected section and select Delete Table. Delete a table
  4. In the Delete table message, click OK.

FAQ

  • Issue description

    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 to be deleted depends on a view. Therefore, the table cannot be deleted.

  • Solution
    Execute the following statement to forcibly delete the table. After the statement is executed, the view that depends on the table is also deleted.
    DROP TABLE [ IF EXISTS ] <table_name> [, ...] CASCADE;