Street address information for customers.
Indexes | Field Name | Data Type | Description |
---|---|---|---|
* | AddressID | int AUTOINCREMENT | Primary key for Address records. |
* | AddressLine1 | nvarchar( 60 ) | First street address line. |
AddressLine2 | nvarchar( 60 ) | Second street address line. | |
* | City | nvarchar( 30 ) | Name of the city. |
* | StateProvince | name | Name of state or province. |
* | CountryRegion | name | |
* | PostalCode | nvarchar( 15 ) | Postal code for the street address. |
* | rowguid | uniqueidentifier DEFAULT newid() | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_Address_AddressID | ON AddressID | Clustered index created by a primary key constraint. | |
AK_Address_rowguid | ON rowguid | ||
IX_Address_AddressLine1_AddressLine2_City_StateProvince_PostalCode_CountryRegion | ON AddressLine1, AddressLine2, City, StateProvince, PostalCode, CountryRegion | Nonclustered index. | |
IX_Address_StateProvince | ON StateProvince | Nonclustered index. |
Customer information.
Indexes | Field Name | Data Type | Description |
---|---|---|---|
* | CustomerID | int AUTOINCREMENT | Primary key for Customer records. |
* | NameStyle | namestyle DEFAULT 0 | 0 = The data in FirstName and LastName are stored in western style (first name, last name) order. 1 = Eastern style (last name, first name) order. |
Title | nvarchar( 8 ) | A courtesy title. For example, Mr. or Ms. | |
* | FirstName | name | First name of the person. |
MiddleName | name | Middle name or middle initial of the person. | |
* | LastName | name | Last name of the person. |
Suffix | nvarchar( 10 ) | Surname suffix. For example, Sr. or Jr. | |
CompanyName | nvarchar( 128 ) | The customer's organization. | |
SalesPerson | nvarchar( 256 ) | The customer's sales person, an employee of AdventureWorks Cycles. | |
EmailAddress | nvarchar( 50 ) | E-mail address for the person. | |
Phone | phone | Phone number associated with the person. | |
* | PasswordHash | varchar( 128 ) | Password for the e-mail account. |
* | PasswordSalt | varchar( 10 ) | Random value concatenated with the password string before the password is hashed. |
* | rowguid | uniqueidentifier DEFAULT newid() | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_Customer_CustomerID | ON CustomerID | Clustered index created by a primary key constraint. | |
AK_Customer_rowguid | ON rowguid | ||
IX_Customer_EmailAddress | ON EmailAddress | Nonclustered index. |
Cross-reference table mapping customers to their address(es).
Indexes | Field Name | Data Type | Description |
---|---|---|---|
* | CustomerID | int | Primary key. Foreign key to Customer.CustomerID. |
* | AddressID | int | Primary key. Foreign key to Address.AddressID. |
* | AddressType | name | The kind of Address. One of: Archive, Billing, Home, Main Office, Primary, Shipping |
* | rowguid | uniqueidentifier DEFAULT newid() | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_CustomerAddress_CustomerID_AddressID | ON CustomerID, AddressID | ||
AK_CustomerAddress_rowguid | ON rowguid | ||
Foreign Keys | |||
FK_CustomerAddress_Address_AddressID | ( AddressID ) ref Address (AddressID) | Foreign key constraint referencing Address.AddressID. | |
FK_CustomerAddress_Customer_CustomerID | ( CustomerID ) ref Customer (CustomerID) | Foreign key constraint referencing Customer.CustomerID. |
Products sold or used in the manfacturing of sold products.
Indexes | Field Name | Data Type | Description |
---|---|---|---|
* | ProductID | int AUTOINCREMENT | Primary key for Product records. |
* | Name | name | Name of the product. |
* | ProductNumber | nvarchar( 25 ) | Unique product identification number. |
Color | nvarchar( 15 ) | Product color. | |
* | StandardCost | money | Standard cost of the product. |
* | ListPrice | money | Selling price. |
Size | nvarchar( 5 ) | Product size. | |
Weight | decimal( 8, 2 ) | Product weight. | |
ProductCategoryID | int | Product is a member of this product category. Foreign key to ProductCategory.ProductCategoryID. | |
ProductModelID | int | Product is a member of this product model. Foreign key to ProductModel.ProductModelID. | |
* | SellStartDate | datetime | Date the product was available for sale. |
SellEndDate | datetime | Date the product was no longer available for sale. | |
DiscontinuedDate | datetime | Date the product was discontinued. | |
ThumbNailPhoto | varbinary(max) | Small image of the product. | |
ThumbnailPhotoFileName | nvarchar( 50 ) | Small image file name. | |
* | rowguid | uniqueidentifier DEFAULT newid() | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_Product_ProductID | ON ProductID | Clustered index created by a primary key constraint. | |
AK_Product_Name | ON Name | ||
AK_Product_ProductNumber | ON ProductNumber | ||
AK_Product_rowguid | ON rowguid | ||
Foreign Keys | |||
FK_Product_ProductCategory_ProductCategoryID | ( ProductCategoryID ) ref ProductCategory (ProductCategoryID) | Foreign key constraint referencing ProductCategory.ProductCategoryID. | |
FK_Product_ProductModel_ProductModelID | ( ProductModelID ) ref ProductModel (ProductModelID) | Foreign key constraint referencing ProductModel.ProductModelID. | |
Constraints | |||
CK_Product_StandardCost | [StandardCost]>=(0.00) | ||
CK_Product_ListPrice | [ListPrice]>=(0.00) | ||
CK_Product_Weight | [Weight]>(0.00) | ||
CK_Product_SellEndDate | [SellEndDate]>=[SellStartDate] OR [SellEndDate] IS NULL | ||
CK_Product_SellEndDate | [SellEndDate]>=[SellStartDate] OR [SellEndDate] IS NULL |
High-level product categorization.
Indexes | Field Name | Data Type | Description |
---|---|---|---|
* | ProductCategoryID | int AUTOINCREMENT | Primary key for ProductCategory records. |
ParentProductCategoryID | int | Product category identification number of immediate ancestor category. Foreign key to ProductCategory.ProductCategoryID. | |
* | Name | name | Category description. |
* | rowguid | uniqueidentifier DEFAULT newid() | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_ProductCategory_ProductCategoryID | ON ProductCategoryID | Clustered index created by a primary key constraint. | |
AK_ProductCategory_Name | ON Name | ||
AK_ProductCategory_rowguid | ON rowguid | ||
Foreign Keys | |||
FK_ProductCategory_ProductCategory_ParentProductCategoryID_ProductCategoryID | ( ParentProductCategoryID ) ref ProductCategory (ProductCategoryID) | Foreign key constraint referencing ProductCategory.ProductCategoryID. |
Product descriptions in several languages.
Indexes | Field Name | Data Type | Description |
---|---|---|---|
* | ProductDescriptionID | int AUTOINCREMENT | Primary key for ProductDescription records. |
* | Description | nvarchar( 400 ) | Description of the product. |
* | rowguid | uniqueidentifier DEFAULT newid() | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_ProductDescription_ProductDescriptionID | ON ProductDescriptionID | Clustered index created by a primary key constraint. | |
AK_ProductDescription_rowguid | ON rowguid |
Indexes | Field Name | Data Type | Description |
---|---|---|---|
* | ProductModelID | int AUTOINCREMENT | |
* | Name | name | |
CatalogDescription | xml | ||
* | rowguid | uniqueidentifier DEFAULT newid() | |
* | ModifiedDate | datetime DEFAULT getdate() | |
Indexes | |||
PK_ProductModel_ProductModelID | ON ProductModelID | Clustered index created by a primary key constraint. | |
AK_ProductModel_Name | ON Name | ||
AK_ProductModel_rowguid | ON rowguid |
Cross-reference table mapping product descriptions and the language the description is written in.
Indexes | Field Name | Data Type | Description |
---|---|---|---|
* | ProductModelID | int | Primary key. Foreign key to ProductModel.ProductModelID. |
* | ProductDescriptionID | int | Primary key. Foreign key to ProductDescription.ProductDescriptionID. |
* | Culture | nchar( 6 ) | The culture for which the description is written |
* | rowguid | uniqueidentifier DEFAULT newid() | |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_ProductModelProductDescription_ProductModelID_ProductDescriptionID_Culture | ON ProductModelID, ProductDescriptionID, Culture | Clustered index created by a primary key constraint. | |
AK_ProductModelProductDescription_rowguid | ON rowguid | ||
Foreign Keys | |||
FK_ProductModelProductDescription_ProductDescription_ProductDescriptionID | ( ProductDescriptionID ) ref ProductDescription (ProductDescriptionID) | Foreign key constraint referencing ProductDescription.ProductDescriptionID. | |
FK_ProductModelProductDescription_ProductModel_ProductModelID | ( ProductModelID ) ref ProductModel (ProductModelID) | Foreign key constraint referencing ProductModel.ProductModelID. |
Individual products associated with a specific sales order. See SalesOrderHeader.
Indexes | Field Name | Data Type | Description |
---|---|---|---|
* | SalesOrderID | int | Primary key. Foreign key to SalesOrderHeader.SalesOrderID. |
* | SalesOrderDetailID | int AUTOINCREMENT | Primary key. One incremental unique number per product sold. |
* | OrderQty | smallint | Quantity ordered per product. |
* | ProductID | int | Product sold to customer. Foreign key to Product.ProductID. |
* | UnitPrice | money | Selling price of a single product. |
* | UnitPriceDiscount | money DEFAULT 0.0 | Discount amount. |
* | LineTotal | numeric( 38, 6 ) | Per product subtotal. Computed as UnitPrice * (1 - UnitPriceDiscount) * OrderQty. |
* | rowguid | uniqueidentifier DEFAULT newid() | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID | ON SalesOrderID, SalesOrderDetailID | Clustered index created by a primary key constraint. | |
AK_SalesOrderDetail_rowguid | ON rowguid | ||
IX_SalesOrderDetail_ProductID | ON ProductID | Nonclustered index. | |
Foreign Keys | |||
FK_SalesOrderDetail_Product_ProductID | ( ProductID ) ref Product (ProductID) | ||
FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID | ( SalesOrderID ) ref SalesOrderHeader (SalesOrderID) | Foreign key constraint referencing SalesOrderHeader.SalesOrderID. | |
Constraints | |||
CK_SalesOrderDetail_OrderQty | [OrderQty]>(0) | ||
CK_SalesOrderDetail_UnitPrice | [UnitPrice]>=(0.00) | ||
CK_SalesOrderDetail_UnitPriceDiscount | [UnitPriceDiscount]>=(0.00) | ||
Triggers | |||
iduSalesOrderDetail |
General sales order information.
Indexes | Field Name | Data Type | Description |
---|---|---|---|
* | SalesOrderID | int AUTOINCREMENT | Primary key. |
* | RevisionNumber | tinyint DEFAULT 0 | Incremental number to track changes to the sales order over time. |
* | OrderDate | datetime DEFAULT getdate() | Dates the sales order was created. |
* | DueDate | datetime | Date the order is due to the customer. |
ShipDate | datetime | Date the order was shipped to the customer. | |
* | Status | tinyint DEFAULT 1 | Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled |
* | OnlineOrderFlag | flag DEFAULT 1 | 0 = Order placed by sales person. 1 = Order placed online by customer. |
* | SalesOrderNumber | nvarchar( 25 ) | Unique sales order identification number. |
PurchaseOrderNumber | ordernumber | Customer purchase order number reference. | |
AccountNumber | accountnumber | Financial accounting number reference. | |
* | CustomerID | int | Customer identification number. Foreign key to Customer.CustomerID. |
ShipToAddressID | int | The ID of the location to send goods. Foreign key to the Address table. | |
BillToAddressID | int | The ID of the location to send invoices. Foreign key to the Address table. | |
* | ShipMethod | nvarchar( 50 ) | Shipping method. Foreign key to ShipMethod.ShipMethodID. |
CreditCardApprovalCode | varchar( 15 ) | Approval code provided by the credit card company. | |
* | SubTotal | money DEFAULT 0.00 | Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID. |
* | TaxAmt | money DEFAULT 0.00 | Tax amount. |
* | Freight | money DEFAULT 0.00 | Shipping cost. |
* | TotalDue | money | Total due from customer. Computed as Subtotal + TaxAmt + Freight. |
Comment | nvarchar(max) | Sales representative comments. | |
* | rowguid | uniqueidentifier DEFAULT newid() | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_SalesOrderHeader_SalesOrderID | ON SalesOrderID | Clustered index created by a primary key constraint. | |
AK_SalesOrderHeader_rowguid | ON rowguid | ||
AK_SalesOrderHeader_SalesOrderNumber | ON SalesOrderNumber | ||
IX_SalesOrderHeader_CustomerID | ON CustomerID | Nonclustered index. | |
Foreign Keys | |||
FK_SalesOrderHeader_Address_BillTo_AddressID | ( BillToAddressID ) ref Address (AddressID) | Foreign key constraint referencing Address.AddressID for BillTo. | |
FK_SalesOrderHeader_Address_ShipTo_AddressID | ( ShipToAddressID ) ref Address (AddressID) | Foreign key constraint referencing Address.AddressID for ShipTo. | |
FK_SalesOrderHeader_Customer_CustomerID | ( CustomerID ) ref Customer (CustomerID) | Foreign key constraint referencing Customer.CustomerID. | |
Constraints | |||
CK_SalesOrderHeader_DueDate | [DueDate]>=[OrderDate] | ||
CK_SalesOrderHeader_ShipDate | [ShipDate]>=[OrderDate] OR [ShipDate] IS NULL | ||
CK_SalesOrderHeader_DueDate | [DueDate]>=[OrderDate] | ||
CK_SalesOrderHeader_ShipDate | [ShipDate]>=[OrderDate] OR [ShipDate] IS NULL | ||
CK_SalesOrderHeader_Status | [Status]>=(0) AND [Status]<=(8) | ||
CK_SalesOrderHeader_SubTotal | [SubTotal]>=(0.00) | ||
CK_SalesOrderHeader_TaxAmt | [TaxAmt]>=(0.00) | ||
CK_SalesOrderHeader_Freight | [Freight]>=(0.00) | ||
Triggers | |||
uSalesOrderHeader |