DROP TABLE
Removes a table and its projections. When you run DROP TABLE
, the change is auto-committed.
Syntax
DROP TABLE [ IF EXISTS ]
[schema.]table-name [, ...] [ CASCADE ]
Parameters
IF EXISTS
|
Specifies not to report an error if one or more of the tables to drop does not exist. This clause is useful in SQL scripts where you want to drop a table if it exists before recreating it. |
schema |
Specifies a schema. If multiple schemas are defined in the database, include the schema name. For example: myschema.thisDbObject |
table‑name
|
The table to drop. |
CASCADE
|
Specifies to drop all projections for this table before the table is dropped. This option is not valid for external tables. |
Privileges
- Table owner with USAGE privilege on table's schema
- Schema owner
Requirements
- Do not cancel an executing
DROP TABLE
. Doing so can leave the database in an inconsistent state. - Check that the target table is not in use, either directly or indirectly—for example, in a view.
- If you drop and restore a table that is referenced by a view, the new table must have the same name and column definitions.
Examples
See Dropping Tables in the Administrator's Guide.