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;