AdventureWorks

Basic Index   Expanded Index

View Name:Person.vStateProvinceCountryRegion
Description:Joins StateProvince table with CountryRegion table.

FieldTypeNulls?
StateProvinceIDintNo
StateProvinceCodenchar (3)No
IsOnlyStateProvinceFlagbitNo
StateProvinceNamenvarchar (50)No
TerritoryIDintNo
CountryRegionCodenvarchar (3)No
CountryRegionNamenvarchar (50)No

CREATE VIEW [Person].[vStateProvinceCountryRegion]
WITH SCHEMABINDING
AS
SELECT
sp.[StateProvinceID]
,sp.[StateProvinceCode]
,sp.[IsOnlyStateProvinceFlag]
,sp.[Name] AS [StateProvinceName]
,sp.[TerritoryID]
,cr.[CountryRegionCode]
,cr.[Name] AS [CountryRegionName]
FROM [Person].[StateProvince] sp
INNER JOIN [Person].[CountryRegion] cr
ON sp.[CountryRegionCode] = cr.[CountryRegionCode];