Name
Drop table -- delete a table
Synopsis
Drop TableName[,...] [Cascade | restrict]
Description
Drop tableDelete a table or view from a database. Only the owner of a table or view can be deleted. To clear a table without deleting the table, useDelete.
Drop tableAlways delete any existing indexes, rules, triggers, and constraints on the target table. However, to delete a table that has a view or other tables referenced by foreign key constraints, we must declareCascade. (CascadeThe referenced view will be deleted, but if it is a foreign key constraint, only the foreign key constraint will be deleted, rather than the other table .)
Parameters
-
Name
-
Name of the existing table to be deleted (it can be modified in the mode ).
- Cascade
-
Automatically delete objects dependent on tables. (For example, view ).
- Restrict
-
If a dependency object exists, the table is denied to be deleted. This is the default value.
Example
DeleteFilmsAndDistributorsTable:
Drop TableFilms, distributors;
Compatibility
This command is compatible with SQL standards. The standard only allows one command to delete a table.
Http://www.php100.com/manual/PostgreSQL8/sql-droptable.html