What View do ?
• First, It help you break down complex queries.
• Secong, Query reusability.
• Third, Security.(not fully recommendable)
What is View ?
View is just a stored query. Can also be said as virtual
table. They don't hold any data into them.Data comes from
real tables.SQL select query operator (WHERE, ORDER BY, etc)
can be used with it.
Script:
File 1:
--GENERAL QUERY
SELECT Ord.OrderID,Ord.CustomerID,Ord.ShipAddress,Ord.ShipCity,Ord.ShipCountry,Ord.ShipName
, Ord.Freight,Ord_d.ProductID,Ord_d.Quantity,Ord_d.UnitPrice FROM Orders Ord inner join
[Order Details] Ord_d
on Ord.OrderID=Ord_d.OrderID inner join Customers Cust
on Cust.CustomerID=Ord.CustomerID