doc-exports/docs/dws/dev/dws_06_0208.html
Lu, Huayi a24ca60074 DWS DEVELOPER 811 version
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2023-01-19 13:37:49 +00:00

5.9 KiB

DROP TABLE

Function

DROP TABLE deletes a specified table.

Precautions

  • Only the table owner, schema owner, and system administrator have the permission to delete a table. To delete all the rows in a table but retain the table definition, use TRUNCATE or DELETE.
  • DROP TABLE forcibly deletes a specified table. After a table is deleted, any indexes that exist for the table will be deleted; any functions or stored procedures that use this table cannot be run. Deleting a partitioned table also deletes all partitions in the table.

Syntax

1
2
DROP TABLE [ IF EXISTS ] 
    { [schema.]table_name } [, ...] [ CASCADE | RESTRICT ];

Parameter Description

  • IF EXISTS

    Sends a notice instead of an error if the specified table does not exist.

  • schema

    Specifies the schema name.

  • table_name

    Specifies the name of the table.

  • CASCADE | RESTRICT
    • CASCADE: automatically deletes objects (such as views) that depend on the table to be deleted.
    • RESTRICT (default): refuses to delete the table if any objects depend on it. This is the default.

Example

Delete the warehouse_t1 table.

1
DROP TABLE tpcds.warehouse_t1;