DROP TABLE

Use the DROP TABLE statement to remove a table from the database.

Usage

DROP TABLE table [CASCADE | RESTRICT]

Notes

Be very careful when using this command. Once a table is dropped, the data it contained is effectively removed from the database, and is no longer visible to commands such as SELECT. This is quite different from the action of DROP VIEW (see later).

Note: No disk space is freed when a table is dropped. The space is only consolidated when the System Administrator issues a RECLAIM command.

If you specify RESTRICT and a view or integrity check is based on the table, the DROP TABLE command fails.

CASCADE removes all dependent views and tables.

Examples

To drop the CUSTOMER table, but include a check to ensure that no views are based on it, use:

DROP TABLE customer RESTRICT

As RESTRICT is the default this is the same as:

DROP TABLE customer

To drop the CUSTOMER table and any views that depend on it, use:

DROP TABLE customer CASCADE