8.3 Getting Started With SQL Views
8.3 Getting Started With SQL Views
VIEW
A VIEW is a virtual table that is based on the result set of a SQL query. It provides a way to encapsulate and
reuse complex queries, simplify data access, and improve security by restricting access to specific data.
order_table
OrderID Amount CustomerID Product ID
view
123 32.000 101 2
OrderID Amount CustomerID Product ID
212 12.500 102 2
123 32.000 Dung Meat
231 21.000 102 1
212 12.500 Hieu Meat
Simplify
Complex Queries
Instead of writing a
complex join or subquery
multiple times, you can
define it once in a view
and reference the view.
BENEFITS OF VIEW
customer_table
Consistency and
Reusability
Using views helps ensure
consistency in your queries
and promotes reusability.
You can define a complex
query once and use it in
multiple places through the
view.
VIEW: Syntax
Syntax