O'Reilly logo

Microsoft® SQL Server 2012 Unleashed by Alex T. Silverstein, Chris Gallelli, Paul T. Bertucci, Ray Rankins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

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]ASSELECT    e.[BusinessEntityID]    ,p.[Title]    ,p.[FirstName]    ,p.[MiddleName]    ,p.[LastName]    ,p.[Suffix]    ,e.[JobTitle]    ,pp.[PhoneNumber]    ,pnt.[Name] AS [PhoneNumberType]    ,ea.[EmailAddress] ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required