DROP VIEW
適用於: Databricks SQL Databricks Runtime
從目錄移除與指定檢視相關聯的元數據。 若要卸除檢視,您必須是檢視的擁有者,或是檢視所在的架構、目錄或中繼存放區擁有者。
語法
DROP [ MATERIALIZED ] VIEW [ IF EXISTS ] view_name
參數
IF EXISTS
如果指定,當檢視不存在時,不會 擲回任何TABLE_OR_VIEW_NOT_FOUND 錯誤。
-
要卸除之檢視的名稱。 如果找不到檢視,Azure Databricks 就會 引發TABLE_OR_VIEW_NOT_FOUND 錯誤。
範例
-- 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;