<commit_before># DROP VIEW

DROP VIEW — remove a view

### Synopsis

```text
DROP VIEW [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
```

### Description

`DROP VIEW` drops an existing view. To execute this command you must be the owner of the view.

### Parameters

`IF EXISTS`

Do not throw an error if the view does not exist. A notice is issued in this case.

_`name`_

The name \(optionally schema-qualified\) of the view to remove.

`CASCADE`

Automatically drop objects that depend on the view \(such as other views\), and in turn all objects that depend on those objects \(see [Section 5.13](https://www.postgresql.org/docs/10/static/ddl-depend.html)\).

`RESTRICT`

Refuse to drop the view if any objects depend on it. This is the default.

### Examples

This command will remove the view called `kinds`:

```text
DROP VIEW kinds;
```

### Compatibility

This command conforms to the SQL standard, except that the standard only allows one view to be dropped per command, and apart from the `IF EXISTS` option, which is a PostgreSQLextension.

### See Also

[ALTER VIEW](alter-view.md), [CREATE VIEW](create-view.md)
<commit_msg>GitBook: [master] one page modified<commit_after>---
description: 版本：10
---

# DROP VIEW

DROP VIEW — 移除檢視表

### 語法

```text
DROP VIEW [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
```

### 說明

DROP VIEW 移除現有檢視表。要執行此命令，您必須是檢視表的擁有者。

### 參數

`IF EXISTS`

如果檢視表不存在，請不要拋出錯誤。在這種情況下發出 NOTICE。

_`name`_

要移除的檢視表名稱（可選擇性加上綱要名稱）。

`CASCADE`

自動移除相依於檢視表的物件（例如其他檢視表），以及相依於這些物件的所有物件（參閱[第 5.13 節](../../the-sql-language/ddl/dependency-tracking.md)）。

`RESTRICT`

如果任何物件相依於它，則拒絕移除檢視表。這是預設行為。

### 範例

此指令將移除名稱為 kinds 的檢視表：

```text
DROP VIEW kinds;
```

### 相容性

此命令符合 SQL 標準，但標準僅允許每個指令移除一個檢視表，並且除了 IF EXISTS 選項（PostgreSQL 延伸功能）之外。

### 參閱

[ALTER VIEW](alter-view.md), [CREATE VIEW](create-view.md)

{'fraction_non_alphanumeric': 0.12936681222707425, 'fraction_numerical': 0.0054585152838427945, 'mean_word_length': 4.1344537815126055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5514484', 'n_tokens_mistral': 855, 'n_tokens_neox': 887, 'n_words': 221}