共用方式為


DROP VIEW

適用於:核取記號為「是」Databricks SQL 核取記號為「是」Databricks Runtime

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

語法

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;