NAME
DROP TABLE - 删除一个表
SYNOPSIS
DROP TABLE name [, ...] [ CASCADE | RESTRICT ]
DESCRIPTION 描述
DROP TABLE 从数据库中删除表或视图。 只有其所有者才能删除一个表或视图。要清空一个表,而不删除表, 使用 DELETE。
DROP TABLE 总是删除目标表上现有的任何索引, 规则,触发器以及约束。但是,要删除一个由另外一个表用外键约束引用的表, 我们必须声明 CASCADE。(CASCADE 将删除外键约束,而不是另外一个表。)
PARAMETERS 参数
- name
要删除的现存表的名字(可以有模式修饰)。- CASCADE
自动删除依赖于表的对象。(比如视图)。- RESTRICT
如果存在依赖对象,则拒绝删除该表。这个是缺省。
EXAMPLES 例子
删除 films 和 distributors表:
DROP TABLE films, distributors;
COMPATIBILITY 兼容性
此命令遵循 SQL 标准。
SEE ALSO 参见
ALTER TABLE [alter_table(7)], CREATE TABLE [create_table(l)]
#p#
NAME
DROP TABLE - remove a table
SYNOPSIS
DROP TABLE name [, ...] [ CASCADE | RESTRICT ]
DESCRIPTION
DROP TABLE removes tables from the database. Only its owner may destroy a table. To empty a table of rows, without destroying the table, use DELETE.
DROP TABLE always removes any indexes, rules, triggers, and constraints that exist for the target table. However, to drop a table that is referenced by a foreign-key constraint of another table, CASCADE must be specified. (CASCADE will remove the foreign-key constraint, not the other table entirely.)
PARAMETERS
- 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, films and distributors:
DROP TABLE films, distributors;
COMPATIBILITY
This command conforms to the SQL standard.
SEE ALSO
ALTER TABLE [alter_table(7)], CREATE TABLE [create_table(l)]