DROP VIEW

Tar bort metadata som är associerade med en angiven vy från katalogen.

Syntax

DROP VIEW [ IF EXISTS ] view_identifier

Parameter

  • IF FINNS

    Om det här alternativet anges genereras inget undantag när vyn inte finns.

  • view_identifier

    Det visnings namn som ska tas bort. Vyns namn kan eventuellt kvalificeras med ett databas namn.

    Syntax:[database_name.] view_name

Exempel

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

-- Assumes a view named `employeeView` exists in the `userdb` database
DROP VIEW userdb.employeeView;

-- Assumes a view named `employeeView` does not exist.
-- Throws exception
DROP VIEW employeeView;
Error: org.apache.spark.sql.AnalysisException: Table or view not found: employeeView;
(state=,code=0)

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