Name
Drop table -- remove a table
Synopsis
Drop Table [If exists]Name[,...] [Cascade | restrict]
Description
Drop tableRemoves tables from the database. Only its owner can drop a table. to empty a table of rows without destroying the table, use delete or truncate.
Drop tableAlways removes any indexes, rules, triggers, and constraints that exist for the target table. However, to drop a table that is referenced by a view or a foreign-key constraint of another table,CascadeMust be specified .(CascadeWill remove a dependent view entirely, but in the foreign-key case it will only remove the foreign-key constraint, Not the other table entirely .)
Parameters
- If exists
-
Do not throw an error if the table does not exist. A notice is issued in this case.
- Name
-
The name (optionally Schema-qualified) of the table to drop.
- Cascade
-
Automatically drop objects that depend on the table (such as views ).
- Restrict
-
Refuse to drop the table if any objects depend on it. This is the default.
Examples
To destroy two tables,FilmsAndDistributors:
Drop TableFilms, distributors;
See also
Alter table, CREATE TABLE
Http://www.postgresql.org/docs/9.1/static/sql-droptable.html