A view can be considered as a virtual table. It is basically a Data representation. It does not physically exist. View is based on the result set of a SQL queries. A view contains rows and tables just like a real table.
View is a collection of a specific data from the different table, view can be used to store Sum, average of values
There are following main features of a View
a. Views can subset data in a table
b. They can join multiple tables into one virtual table
c. Views can provide security and decrease complexity
d. They save space because only their definition is stored.
Lets take an example to understand more about views
To Create a View yo need to have some database table on which you can apply some condition and retrive data in a proper from.
There is two table Student_Info and MarkSheet
1. select * from Student_Info
2. Select * from MarkSheet
Now there is a requirement that we need to find some some academically good student,who have good marks from all Student
We can create a View GoodStudent of Student who have marks 60% or above
Creating a View
3. Create View GoodStudent As
select SI.Student_Id,SI.Student_Name,SI.Class,SI.City,MS.Marks from Student_Info SI
inner join MarkSheet MS
on SI.Student_Id = MS.Student_Id
where MS.Marks >= 60
The View GoodStudent has been created, which have all academically good Student
4. Select * from GoodStudent
This is the final Output of this View
View is a collection of a specific data from the different table, view can be used to store Sum, average of values
There are following main features of a View
a. Views can subset data in a table
b. They can join multiple tables into one virtual table
c. Views can provide security and decrease complexity
d. They save space because only their definition is stored.
Lets take an example to understand more about views
To Create a View yo need to have some database table on which you can apply some condition and retrive data in a proper from.
There is two table Student_Info and MarkSheet
1. select * from Student_Info
2. Select * from MarkSheet
Now there is a requirement that we need to find some some academically good student,who have good marks from all Student
We can create a View GoodStudent of Student who have marks 60% or above
Creating a View
3. Create View GoodStudent As
select SI.Student_Id,SI.Student_Name,SI.Class,SI.City,MS.Marks from Student_Info SI
inner join MarkSheet MS
on SI.Student_Id = MS.Student_Id
where MS.Marks >= 60
The View GoodStudent has been created, which have all academically good Student
4. Select * from GoodStudent
This is the final Output of this View
No comments:
Post a Comment