ALTER VIEW
A previously created view can be modified using the ALTER VIEW statement.
Syntax:
ALTER VIEW view_name AS select_statement
Example 1:
ALTER VIEW example_view_name AS (SELECT companyname, productname FROM orderDetailsObject)
Example 2:
ALTER VIEW sophisticatedExampleView as (
SELECT o.orderdate,
c.country,
ca.categoryname,
p.productname,
p.categoryid,
o.customerid,
c.companyname,
od.productid,
sum(od.discount) AS discount,
sum(od.quantity) AS quantity,
sum(od.quantity*od.unitprice) AS sales
FROM nw_orderdetails od
INNER JOIN nw_orders o
ON od.orderid=o.orderid
INNER JOIN nw_customers c
ON o.customerid=c.customerid
INNER JOIN nw_products p
ON od.productid=p.productid
INNER JOIN nw_categories ca
ON p.categoryid=ca.categoryid
GROUP BY o.orderdate,c.country, o.customerid, c.companyname, od.productid, p.productname, p.categoryid, ca.categoryname
ORDER BY o.customerid, ca.categoryname,p.productname ASC )