Duration: 17:11 min
Summary: In this video, we will talk about views. SQL Server books online define a view as follows: "A view can be thought of as either a virtual table or a stored query. The data accessible through a view is not stored in the database as a distinct object. What is stored in the database is a select statement. The result set of the select statement forms the virtual table returned by the view. A user can use this virtual table by referencing the view name in Transact-SQL statements the same way a table is referenced."
The view can help in the following ways:
- Restrict a user to specific rows in a table, and to specific columns. For example, say the table contains social security numbers, and you do not want the user to have access to that.
- Join columns from multiple tables so that they look like a single table. Say, the marketing department needs to look at a set of data for the North region. You can provide them with a view they cal select from instead of having them create the script. 3- Aggregate information instead of supplying details. This will help in the case you do not want the user to see the details for security reasons.