What are the advantages of VIEW?
Gaurav Malviya
Restrict a user to specific rows in a table.For example, allow an employee to see only the rows recording his or her work in a labor-tracking table.Restrict a user to specific columns.For example, allow employees who do not work in payroll to see the name, office, work phone, and department columns in an employee table, but do not allow them to see any columns with salary information or personal information.Join columns from multiple tables so that they look like a single table.Aggregate information instead of supplying details.For example, present the sum of a column, or the maximum or minimum value from a column.
View can be categorized either as a compiled sql query or a virtual table. As a view represents a virtual table, it does not physically store any data. When you query a view, you actually retrieve the data from the underlying base tables. Some more advantages:1.Views can be used to implement row level and column level security.Example 1: Consider the tblEmployee table. I don't want some of the users to have access to the salary column, but they should still be able to access ID, NAME and DEPT columns. If I grant access to the table, the users will be able to see all the columns. So, to achieve this, I can create a view. Now, grant access to the view and not the table. So using views we can provide column level security. 2. Simplify the database schema to the users. You can create a view based on multiple tables which join columns from all these multiple tables so that they look like a single table. 3. Views can be used to present aggregated and summarized data. 4. Parametrized views can be created using Inline UDF. 5. View can be materialized when indexed.
- To protect some of the columns of a table from other users. - To hide complexity of a query. - To hide complexity of calculations.
- To hide complexity of a query. - To hide complexity of calculations. - Security
The main use of view is hiding some rows data or some columnshttp://headfirstsql.blogspot.in/2014/07/views-in-real-time-senario.html