drop_table 中文man頁面
NAME
DROP TABLE - 刪除一個表
SYNOPSIS
DROP TABLE name [, ...] [ CASCADE | RESTRICT ]
DESCRIPTION 描述
DROP TABLE 從數(shù)據(jù)庫中刪除表或視圖。 只有其所有者才能刪除一個表或視圖。要清空一個表,而不刪除表, 使用 DELETE。
DROP TABLE 總是刪除目標表上現(xiàn)有的任何索引, 規(guī)則,觸發(fā)器以及約束。但是,要刪除一個由另外一個表用外鍵約束引用的表, 我們必須聲明 CASCADE。(CASCADE 將刪除外鍵約束,而不是另外一個表。)
PARAMETERS 參數(shù)
- name
要刪除的現(xiàn)存表的名字(可以有模式修飾)。- 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)]