Drops an existing view.

Syntax

drop view [if exists] <view_name>;

Parameters

  • if exists: optional. If you run the command without specifying the if exists option and the view does not exist, an error is returned.
  • view_name: required. The name of the view that you want to drop.

Example

-- Drop the sale_detail_view view. 
drop view if exists sale_detail_view;

Related commands

  • CREATE VIEW: Creates a view or updates an existing view based on a query statement.
  • ALTER VIEW: Renames an existing view or changes the owner of an existing view.
  • DESC VIEW: Views the information of an existing view.