Definition of Views

Views are a logical way of viewing data in the underlying physical tables. They are tied to a SELECT statement that retrieves data from one or more tables or views in the same database or a different database. In most cases, no physical storage of data is associated with the view, and the SELECT that is associated with the view is run dynamically whenever the view is referenced.

The following T-SQL statement can be used to create a simple view in the AdventureWorks2012 database:

CREATE VIEW [dbo].[vw_CustomerAddress]ASSELECT     Sales.Customer.CustomerID, Sales.Customer.AccountNumber, Person.Address.AddressLine1, Person.Address.StateProvinceID, Person.Address.City, Person.Address.PostalCode

Get Microsoft® SQL Server 2012 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.