Focusing on Specific Data

Views allow users or developers to focus on the specific data elements they need to work with. Tables that contain hundreds of columns or columns that have limited value for the end user can be filtered with a view such that only the relevant data elements are returned. Views can also filter the rows of data that are returned. This can be particularly useful for tables that have a large number of rows. The View can contain a WHERE clause that limits the number of rows that are returned.

The HumanResources.vEmployee view in the AdventureWorks2012 database is a good example of a view that focuses on specific data and simplifies data access. The view definition follows:

CREATE VIEW [HumanResources].[vEmployee] ...

Get Microsoft SQL Server 2014 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.