Views part-1

You can say that the view is nothing but a virtual table or a compiled query. Physically view can not store any data, but while compiling view query it get the data from the base tables.

 The following are the primary advantages of views.

The view provides the security for the row level and column level.
Now let us consider the following employee table.

From the above table, I do not want to give salary column access to the user then i supposed to create a view as follows.

create view vWhidesalary
as
select emp_id,empname,dept_no,designation,location
from Employee 


 Now compile the view query as follows.

select * from vWhidesalary





 If you want to give access only for particular dept_no then the query should be as follows.

create view hidesalary
as
select emp_id,empname,dept_no,designation,location
from Employee WHERE dept_no=2


 Now compile the view query as follows.

select * from vWhidesalary


 
Click here for Views part - 2

No comments:

Post a Comment

What is Normalization?

Database normalization is a data design and organization process applied to data structures based on rules that help building relational dat...