分享方式:


DROP VIEW

適用於: 檢查標示為是 Databricks SQL 檢查標示為是 Databricks Runtime

從目錄移除與指定檢視相關聯的元數據。 若要卸除檢視,您必須是檢視的擁有者,或是檢視所在的架構、目錄或中繼存放區擁有者。

語法

DROP [ MATERIALIZED ] VIEW [ IF EXISTS ] view_name

參數

範例

-- Assumes a view named `employeeView` exists.
> DROP VIEW employeeView;

-- Assumes a view named `employeeView` exists in the `usersc` schema
> DROP VIEW usersc.employeeView;

-- Assumes a view named `employeeView` does not exist.
-- Throws TABLE_OR_VIEW_NOT_FOUND
> DROP VIEW employeeView;
  [TABLE_OR_VIEW_NOT_FOUND]

-- Assumes a materialized view named `employeeView` exists.
> DROP MATERIALIZED VIEW employeeView

-- Assumes a view named `employeeView` does not exist. Try with IF EXISTS
-- this time it will not throw exception
> DROP VIEW IF EXISTS employeeView;