AdventureWorks 数据库:表结构和模式概述
AdventureWorks 数据库 (SQL Server) 是一个示例数据集,模拟了一个虚构制造公司的业务流程。
本页面展示了表结构、关键列和用于实际 SQL 学习和查询练习的关系。
AdventureWorks 数据库包含 10 个主要表。
AdventureWorks 数据库 ER 图
了解更多 AdventureWorks 数据库:模式、示例查询和全部练习 →
表列表
Address - 地址表。
- AddressID每个地址的唯一标识符 (PK)
- AddressLine1地址的第一行
- AddressLine2地址的第二行
- City城市
- StateProvince州或省
- CountryRegion国家
- PostalCode邮政编码
- rowguidguid
- ModifiedDate行创建或最后更新的时间戳
| AddressID |
AddressLine1 |
AddressLine2 |
City |
StateProvince |
CountryRegion |
PostalCode |
rowguid |
ModifiedDate |
| 9 |
8713 Yosemite Ct. |
null |
Bothell |
Washington |
United States |
98011 |
268AF621-76D7-4C78-9441-144FD139821A |
2006-07-01 00:00:00.000 |
Customer - 客户表。
- CustomerID每个客户的唯一标识符 (PK)
- NameStyle0 = FirstName 和 LastName 的数据以西方风格(名,姓)顺序存储。1 = 东方风格(姓,名)顺序。默认:0
- Title称谓
- FirstName名字
- MiddleName中间名
- LastName姓
- Suffix后缀
- CompanyName公司名称
- SalesPerson销售人员
- EmailAddress电子邮件
- Phone电话号码
- PasswordHash密码哈希
- PasswordSalt盐
- rowguidrowguid
- ModifiedDate行创建或最后更新的时间戳
| CustomerID |
NameStyle |
Title |
FirstName |
MiddleName |
LastName |
Suffix |
CompanyName |
SalesPerson |
EmailAddress |
Phone |
PasswordHash |
PasswordSalt |
rowguid |
ModifiedDate |
| 1 |
0 |
先生 |
Orlando |
N. |
Gee |
[null] |
A Bike Store |
adventure-works\pamela0 |
orlando0@adventure-works.com |
245-555-0173 |
L/Rlwxzp4w7RWmEgXX+/A7cXaePEPcp+KwQhl2fJL7w= |
1KjXYs4= |
3F5AE95E-B87D-4AED-95B4-C3797AFCB74F |
2005-08-01 00:00:00.000 |
CustomerAddress - 客户与地址的关系。
- CustomerID客户在 Customer 表中的标识符
- AddressID地址在 Address 表中的标识符
- AddressType地址类型
- rowguidguid
- ModifiedDate行创建或最后更新的时间戳
- 主键,btree (CustomerID, AddressID)
- 外键 (CustomerID) 参考 Customer(CustomerID)
- 外键 (AddressID) 参考 Address(AddressID)
| CustomerID |
AddressID |
AddressType |
rowguid |
ModifiedDate |
| 29485 |
1086 |
主办公室 |
16765338-DBE4-4421-B5E9-3836B9278E63 |
2007-09-01 00:00:00.000 |
Product - 产品表。
- ProductID每个产品的唯一标识符 (PK)
- Name产品名称
- ProductNumber商品编号
- Color产品颜色
- StandardCost产品价格
- ListPrice产品在目录中的价格
- Size产品尺寸
- Weight产品重量
- ProductCategoryID指向 ProductCategory 表的外键
- ProductModelID指向 ProductModel 表的外键
- SellStartDate销售开始日期的时间戳
- SellEndDate销售结束日期的时间戳
- DiscontinuedDate停止销售日期的时间戳
- ThumbNailPhoto产品缩略图
- ThumbnailPhotoFileName
缩略图文件名
- rowguidguid
- ModifiedDate行创建或最后更新的时间戳
- 主键,btree (ProductID, ProductCategoryID, ProductModelID)
- 外键 (ProductCategoryID) 参考 ProductCategory(ProductCategoryID)
- 外键 (ProductModelID) 参考 ProductModel(ProductModelID)
| ProductID |
Name |
ProductNumber |
Color |
StandardCost |
ListPrice |
Size |
Weight |
ProductCategoryID |
ProductModelID |
SellStartDate |
SellEndDate |
DiscontinuedDate |
ThumbNailPhoto |
ThumbnailPhotoFileName |
rowguid |
ModifiedDate |
| 680 |
HL Road Frame - Black, 58 |
FR-R92B-58 |
黑色 |
1059.3100 |
1431.5000 |
58 |
1016.04 |
18 |
6 |
2002-06-01 00:00:00.000 |
[null] |
[null] |
[binary] |
no_image_available_small.gif |
43DD68D6-14A4-461F-9069-55309D90EA7E |
2008-03-11 10:01:36.827 |
ProductCategory - 产品类别表。
- ProductCategoryID每个产品类别的唯一标识符 (PK)
- ParentProductCategoryID父产品类别的 ID
- Name产品类别名称
- rowguidguid
- ModifiedDate行创建或最后更新的时间戳
- 主键,btree (ProductCategoryID)
- 外键 (ParentProductCategoryID) 参考 ProductCategory(ProductCategoryID)
| ProductCategoryID |
ParentProductCategoryID |
Name |
rowguid |
ModifiedDate |
| 1 |
[null] |
自行车 |
CFBDA25C-DF71-47A7-B81B-64EE161AA37C |
2002-06-01 00:00:00.000 |
ProductDescription - 产品描述表。
- ProductDescriptionID记录的唯一标识符 (PK)
- Description产品描述
- rowguidguid
- ModifiedDate行创建或最后更新的时间戳
- 主键,btree (ProductDescriptionID)
| ProductDescriptionID |
Description |
rowguid |
ModifiedDate |
| 4 |
Aluminum alloy cups; large diameter spindle. |
DFEBA528-DA11-4650-9D86-CAFDA7294EB0 |
2007-06-01 00:00:00.000 |
ProductModel - 产品型号表。
- ProductModelID每条记录的唯一标识符 (PK)
- Name产品型号名称
- CatalogDescriptionXML 格式的描述
- rowguidguid
- ModifiedDate行创建或最后更新的时间戳
- 主键,btree (ProductModelID)
| ProductModelID |
Name |
CatalogDescription |
rowguid |
ModifiedDate |
| 1 |
Classic Vest |
[null] |
29321D47-1E4C-4AAC-887C-19634328C25E |
2007-06-01 00:00:00.000 |
ProductModelProductDescription - 产品型号描述表。
- ProductModelIDProductModel 表中的型号标识符
- ProductDescriptionIDProductDescription 表中的描述标识符
- CultureISO 格式的语言代码
- rowguidguid
- ModifiedDate行创建或最后更新的时间戳
- 主键,btree (ProductModelID, ProductDescriptionID)
- 外键 (ProductModelID) 参考 ProductModel(ProductModelID)
- 外键 (ProductDescriptionID) 参考 ProductDescription(ProductDescriptionID)
| ProductModelID |
ProductDescriptionID |
Culture |
rowguid |
ModifiedDate |
| 1 |
1199 |
en |
4D00B649-027A-4F99-A380-F22A46EC8638 |
2007-06-01 00:00:00.000 |
SalesOrderDetail - 销售订单明细表。
- SalesOrderID引用 SalesOrderHeader 表的外键
- SalesOrderDetailID表中记录的唯一标识符
- OrderQty数量
- ProductID引用 Product 表的外键
- UnitPrice单价
- UnitPriceDiscount单价折扣
- LineTotal行合计金额
- rowguidguid
- ModifiedDate行创建或最后更新的时间戳
- 主键,btree (SalesOrderID, SalesOrderDetailID, ProductID)
- 外键 (SalesOrderID) 参考 SalesOrderHeader(SalesOrderID)
- 外键 (ProductID) 参考 Product(ProductID)
| SalesOrderID |
SalesOrderDetailID |
OrderQty |
ProductID |
UnitPrice |
UnitPriceDiscount |
LineTotal |
rowguid |
ModifiedDate |
| 71774 |
110562 |
1 |
836 |
356.8980 |
.0000 |
356.898000 |
E3A1994C-7A68-4CE8-96A3-77FDD3BBD730 |
2008-06-01 00:00:00.000 |
SalesOrderHeader - 产品销售订单。
- SalesOrderID表中记录的唯一标识符 (PK)
- RevisionNumber修订号
- OrderDate订单创建日期
- DueDate订单付款到期日期
- ShipDate订单发货日期
- Status订单状态
- OnlineOrderFlag在线订单(是/否)
- SalesOrderNumber订单号
- PurchaseOrderNumber采购订单号
- AccountNumber账号
- CustomerID引用 Customer 表的外键
- ShipToAddressID引用 Address 表的外键,表示收货地址
- BillToAddressID引用 Address 表的外键,表示账单地址
- ShipMethod配送方式
- CreditCardApprovalCode
信用卡授权码
- SubTotal小计
- TaxAmt税额
- Freight运费
- TotalDue总计
- Comment备注
- rowguidguid
- ModifiedDate行创建或最后更新的时间戳
- 主键,btree (SalesOrderID, CustomerID, ShipToAddressID, BillToAddressID)
- 外键 (CustomerID) 参考 Customer(CustomerID)
- 外键 (ShipToAddressID) 参考 Address(AddressID)
- 外键 (BillToAddressID) 参考 Address(AddressID)
| SalesOrderID |
RevisionNumber |
OrderDate |
DueDate |
ShipDate |
Status |
OnlineOrderFlag |
SalesOrderNumber |
PurchaseOrderNumber |
AccountNumber |
CustomerID |
ShipToAddressID |
BillToAddressID |
ShipMethod |
CreditCardApprovalCode |
SubTotal |
TaxAmt |
Freight |
TotalDue |
Comment |
rowguid |
ModifiedDate |
| 71774 |
2 |
2008-06-01 00:00:00.000 |
2008-06-13 00:00:00.000 |
2008-06-08 00:00:00.000 |
5 |
0 |
SO71774 |
PO348186287 |
10-4020-000609 |
29847 |
1092 |
1092 |
CARGO TRANSPORT 5 |
[null] |
880.3484 |
70.4279 |
22.0087 |
972.7850 |
[null] |
89E42CDC-8506-48A2-B89B-EB3E64E3554E |
2008-06-08 00:00:00.000 |