AdventureWorks 與 pubs 資料表的比較

AdventureWorks 範例資料庫中的一些資料表,在結構及內容上與 pubs 範例資料庫中的一些資料表類似。您可以使用下表,從適當的 AdventureWorks 資料表選取資料行,將使用 pubs 的查詢轉換為使用 AdventureWorks 的查詢。例如,如果查詢參考 pubs 中的 discounts 資料表,那麼使用 Sales.SpecialOffer 資料表,就可以為 AdventureWorks 撰寫類似的查詢。請注意,AdventureWorks 使用 dbo 以外的結構描述名稱。結構描述名稱含在資料表名稱內,且針對資料表執行查詢時必須指定。如需詳細資訊,請參閱<AdventureWorks 中的結構描述>。

pubs

AdventureWorks

註解

authors

Purchasing.Vendor

 

discounts

Sales.SpecialOffer

 

employee

HumanResources.Employee

 

jobs

HumanResources.Employee

請參閱 Employee 中的 Title 資料行。

pub_info

Production.ProductPhoto

Production.ProductDescription

 

publishers

Sales.Store

Person.Address

Sales.CustomerAddress

Person.CountryRegion

Person.StateProvince

下列查詢在 publishers 資料表中提供相等的資訊。

USE AdventureWorks;

GO

SELECT S.CustomerID, S.Name

  AS Store, A.City, SP.Name AS

  State, CR.Name AS CountryRegion

FROM Sales.Store AS S

JOIN Sales.CustomerAddress CA

ON CA.CustomerID =  S.CustomerID

JOIN Person.Address AS A ON  A.AddressID = CA.AddressID

JOIN Person.StateProvince AS SP

ON SP.StateProvinceID =  A.StateProvinceID

JOIN Person.CountryRegion AS CR

ON CR.CountryRegionCode = SP.CountryRegionCode

GROUP BY S.CustomerID, S.Name,

    A.City, SP.Name, CR.Name

ORDER BY S.CustomerID;

roysched

Sales.SpecialOffer

請參閱 MinQtyMaxQty 資料行。

sales

Sales.SalesOrderHeader

Sales.SalesOrderDetail

 

stores

Sales.Store

 

titleauthor

Production.ProductVendor

titleauthor 是對應作者與標題的關聯資料表。Production.ProductVendor 對應供應商與其銷售給 Adventure Works Cycles 的產品。

titles

Production.Product