Connecting Excel to SQL Statements
Just as there are tables in SQL Server within our AdventureWorks2014
database for us to query on, there are also predefined views that are available for us to use; for all practical purposes, these views behave exactly the same as tables. The views are available at the following location within SQL Server:
The following script can be used to pull store information such as postal codes and the number of employees:
SELECT StoreAddress.City as 'City' ,StoreAddress.Name as 'Store Name' ,StoreAddress.PostalCode as 'Postal Code' ,sum(StoreDemo.NumberEmployees) as 'Number of Employees' FROM [AdventureWorks2014].[Sales].[vStoreWithAddresses] as StoreAddress INNER JOIN [AdventureWorks2014].[Sales].[vStoreWithDemographics] StoreDemo on StoreAddress.BusinessEntityID=StoreDemo.BusinessEntityID Group by StoreAddress.City ,StoreAddress.Name ,StoreAddress.PostalCode order...