What is view?
View is the simply subset of table which are stored logically in a database means a view is a virtual table in the database whose contents are defined by a query.
To the database user, the view appears just like a real table, with a set of named columns and rows of data. SQL creates the illusion of the view by giving the view a name like a table name and storing the definition of the view in the database.
Views are used for security purpose in databases, views restricts the user from viewing certain column and rows means by using view we can apply the restriction on accessing the particular rows and columns for specific user. Views display only those data which are mentioned in the query, so it shows only data which is returned by the query that is defined at the time of creation of the View.
Advantages of views
Each user can be given permission to access the database only through a small set of views that contain the specific data the user is authorized to see, thus restricting the user's access to stored data
A view can draw data from several different tables and present it as a single table, turning multi-table queries into single-table queries against the view.
Views can give a user a "personalized" view of the database structure, presenting the database as a set of virtual tables that make sense for that user.
A view can present a consistent, unchanged image of the structure of the database, even if the underlying source tables are split, restructured, or renamed.
If data is accessed and entered through a view, the DBMS can automatically check the data to ensure that it meets the specified integrity constraints.
Logical data independence.
View can make the application and database tables to a certain extent independent. If there is no view, the application must be based on a table. With the view, the program can be established in view of above, to view the program with a database table to be separated.
Disadvantages of views
Views create the appearance of a table, but the DBMS must still translate queries against the view into queries against the underlying source tables. If the view is defined by a complex, multi-table query then simple queries on the views may take considerable time.
When a user tries to update rows of a view, the DBMS must translate the request into an update on rows of the underlying source tables. This is possible for simple views, but more complex views are often restricted to read-only.
Post a Comment