Sales.vStoreWithAddresses
Documentation | AdventureWorks |
Schema | Sales |
Name | vStoreWithAddresses |
Module | Sales |
Stores (including store addresses) that sell Adventure Works Cycles products to consumers.
Columns
Key | Name | Data type | Null | Attributes | References | Description | ||
---|---|---|---|---|---|---|---|---|
1 | BusinessEntityID | int | ||||||
2 | Name | nvarchar(50) | ||||||
3 | AddressType | nvarchar(50) | ||||||
4 | AddressLine1 | nvarchar(60) | ||||||
5 | AddressLine2 | nvarchar(60) | ||||||
6 | City | nvarchar(30) | ||||||
7 | StateProvinceName | nvarchar(50) | ||||||
8 | PostalCode | nvarchar(15) | ||||||
9 | CountryRegionName | nvarchar(50) |
Uses
Name |
---|
Sales.vStoreWithAddresses
|
Script
CREATE VIEW [Sales].[vStoreWithAddresses] AS SELECT s.[BusinessEntityID] ,s.[Name] ,at.[Name] AS [AddressType] ,a.[AddressLine1] ,a.[AddressLine2] ,a.[City] ,sp.[Name] AS [StateProvinceName] ,a.[PostalCode] ,cr.[Name] AS [CountryRegionName] FROM [Sales].[Store] s INNER JOIN [Person].[BusinessEntityAddress] bea ON bea.[BusinessEntityID] = s.[BusinessEntityID] INNER JOIN [Person].[Address] a ON a.[AddressID] = bea.[AddressID] INNER JOIN [Person].[StateProvince] sp ON sp.[StateProvinceID] = a.[StateProvinceID] INNER JOIN [Person].[CountryRegion] cr ON cr.[CountryRegionCode] = sp.[CountryRegionCode] INNER JOIN [Person].[AddressType] at ON at.[AddressTypeID] = bea.[AddressTypeID]; |
Exported: 2019-02-04 23:13, Last imported: 2018-03-07 11:56