PostgreSQL drop table (en)

Source: Internet
Author: User
Tags key case
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.