DROP VIEW command allows you to delete a view. This command removes the specified view, but does not affect the underlying tables that the view was based on.
The syntax for a
DROP VIEW statement is:
DROP VIEW [IF EXISTS] view_name
VIEW: Keyword used to specify that a view should be dropped.
IF EXISTS: This is an optional clause. If the
IF EXISTSclause is included, the statement will not return an error if the specified view does not exist. If the
IF EXISTSclause is not included and the specified view does not exist, the statement will result in an error.
view_name: The name of the view to be dropped.
Here is an example of a
DROP VIEW statement:
DROP VIEW IF EXISTS my_view
This example deletes the view
my_view if it exists.