VIEWS

A view is a virtual table, which gives access to a subset of column from one or more tables. A view serves as a security mechanism. This ensures that users are able to retrieve and modify only that data on which the permission has been granted to them. Views ensure security of data by restricting access to

following data: • •

Specific rows of the table Specific column of the table Rows fetched by using joined Statistical summary of data in a given table Subsets of another view.


Cr e ati ng v i e ws i n S Q L :
For creation of view in SQL there is a statement: CREATE VIEW SYNTEX OF THE CREATE VIEW STATEMENT:

)] As select_statement The restriction imposed on views is as follows: • A view can be created only in the current database. Syscolumns –stores the names of the column defined n the view. on its base • The SELECTINTO statement cannot be used in a view declaration statement. • A view can be created only if there is the SELECT permission table.CREATE VIEW view_name [(column_ name. . column_ name. G e tti ng V i e w I nf or m a t i on : SQL Server stores information of a view in the following system tables: • • Sysobjects – stores the name of the view.…. • A view cannot derive its data from temporary tables.

It has no effect on table Syntax of DROP VIEW Statement: DROP VIEW view_name Re nami n g of a v ie w : .• Sysdepends – stores information on the view dependencies. Syntax of ALTER VIEW statement: ALTER VIEW view_name[(column_name)] AS Select_statement Dr oppi n g a v ie w : A view can be dropped from a database using DROP VIEW statement. AL T E RI N G V I EW : A view can be modified without dropping it. This ensures that the permission on the view is not lost. • Syacomments –stores the text of view definition.

however permission doesn’t lost Syntax of renaming: Sp_rename old_view_viewname new_viewname A d v a n t a g e o f vi e w s : • • • Focuses data for users Hides data complexity Simplifies permission management .A view can be renamed without dropping it.

Sign up to vote on this title
UsefulNot useful