Experiment-11 AIM - Introduction To Views. VIEWS A View Is, in Essence, A Virtual Table. It Does Not Physically Exist. Rather, It Is Created
Experiment-11 AIM - Introduction To Views. VIEWS A View Is, in Essence, A Virtual Table. It Does Not Physically Exist. Rather, It Is Created
PURPOSE OF VIEWS Views are used to select particular columns from a table which is
residing in a different DB. Thus it serves as a security mechanism. Once views are created we
can access the view to get the specified column details from the table which is present in a
different DB. Sometimes we need to use the same query repeatedly for a large number of times.
So instead of writing the same query all the times we use views. Using view we can avoid the
complex queries.
FUNCTIONS OF VIEWS
Views can subset data in a table
They can join multiple tables into one virtual table
They can act as aggregated tables. i.e. a view can be used to store Sum, average of values
Views can be nested and can be used for abstraction
Views can provide security and decrease complexity
They save space because only their definition is stored.
Materialized views are commonly used in data warehousing. They represent a snapshot
of the data from remote sources.
Just as functions (in programming) can provide abstraction, so database users can create
abstraction by using views. In another parallel with functions, database users can manipulate
nested views, thus one view can aggregate data from other views. Without the use of views the
normalization of databases above second normal form would become much more difficult.
Views can make it easier to create lossless join decomposition.
A view is a relational table, and the relational model defines a table as a set of rows. Since sets
are not ordered - by definition - the rows in a view are not ordered, either. Therefore, an ORDER
BY clause in the view definition is meaningless. The SQL standard does not allow an ORDER
BY clause in a subselect in a CREATE VIEW statement, just as it is not allowed in a CREATE
TABLE statement. However, sorted data can be obtained from a view, in the same way as any
other table - as part of a query statement.
OPERATIONS ON VIEWS
Creating A View
It does not show the row 1010. Because extmarks is not according to WHERE condition.
Creating A view Using CHECK OPTION
Insertion When CHECK OPTION is Used But Does Not Match The WHERE condition
Dropping A View
Outer-Join
Cartesian-Join
Self Join