WideWorldImporters

Sales.Orders

//
Detail of customer orders

Created: Modified:

Columns

  • //
    ${escapify(column.description)}
    OrderID
    [int] NOT NULL DEFAULT (NEXT VALUE FOR [Sequences].[OrderID])
  • //
    ${escapify(column.description)}
    CustomerID
    [int] NOT NULL
  • //
    ${escapify(column.description)}
    SalespersonPersonID
    [int] NOT NULL
  • //
    ${escapify(column.description)}
    PickedByPersonID
    [int] NULL
  • //
    ${escapify(column.description)}
    ContactPersonID
    [int] NOT NULL
  • //
    ${escapify(column.description)}
    BackorderOrderID
    [int] NULL
  • //
    ${escapify(column.description)}
    OrderDate
    [date] NOT NULL
  • //
    ${escapify(column.description)}
    ExpectedDeliveryDate
    [date] NOT NULL
  • //
    ${escapify(column.description)}
    CustomerPurchaseOrderNumber
    [nvarchar](20) NULL
  • //
    ${escapify(column.description)}
    IsUndersupplyBackordered
    [bit] NOT NULL
  • //
    ${escapify(column.description)}
    Comments
    [nvarchar](MAX) NULL
  • //
    ${escapify(column.description)}
    DeliveryInstructions
    [nvarchar](MAX) NULL
  • //
    ${escapify(column.description)}
    InternalComments
    [nvarchar](MAX) NULL
  • //
    ${escapify(column.description)}
    PickingCompletedWhen
    [datetime2](8) NULL
  • LastEditedBy
    [int] NOT NULL
  • LastEditedWhen
    [datetime2](8) NOT NULL DEFAULT (sysdatetime())

Indexes

  • PK_Sales_Orders
    UNIQUE CLUSTERED
    OrderID
  • //
    Auto-created to support a foreign key
    FK_Sales_Orders_CustomerID
    NONCLUSTERED
    CustomerID
  • //
    Auto-created to support a foreign key
    FK_Sales_Orders_SalespersonPersonID
    NONCLUSTERED
    SalespersonPersonID
  • //
    Auto-created to support a foreign key
    FK_Sales_Orders_PickedByPersonID
    NONCLUSTERED
    PickedByPersonID
  • //
    Auto-created to support a foreign key
    FK_Sales_Orders_ContactPersonID
    NONCLUSTERED
    ContactPersonID

Foreign Keys

  • FK_Sales_Orders_Application_People
    Application.People
    LastEditedBy ⥱ PersonID
  • FK_Sales_Orders_BackorderOrderID_Sales_Orders
    Sales.Orders
    BackorderOrderID ⥱ OrderID
  • FK_Sales_Orders_ContactPersonID_Application_People
    Application.People
    ContactPersonID ⥱ PersonID
  • FK_Sales_Orders_CustomerID_Sales_Customers
    Sales.Customers
    CustomerID ⥱ CustomerID
  • FK_Sales_Orders_PickedByPersonID_Application_People
    Application.People
    PickedByPersonID ⥱ PersonID
  • FK_Sales_Orders_SalespersonPersonID_Application_People
    Application.People
    SalespersonPersonID ⥱ PersonID

Sample Data

OrderID
CustomerID
SalespersonPersonID
PickedByPersonID
ContactPersonID
BackorderOrderID
OrderDate
ExpectedDeliveryDate
CustomerPurchaseOrderNumber
IsUndersupplyBackordered
Comments
DeliveryInstructions
InternalComments
PickingCompletedWhen
LastEditedBy
LastEditedWhen
1
832
2
NULL
3032
45
12126
true
NULL
NULL
NULL
7
2
803
8
NULL
3003
46
15342
true
NULL
NULL
NULL
7
3
105
7
NULL
1209
47
12211
true
NULL
NULL
NULL
7
4
57
16
3
1113
NULL
17129
true
NULL
NULL
NULL
3
5
905
3
NULL
3105
48
10369
true
NULL
NULL
NULL
7
6
976
13
3
3176
NULL
13383
true
NULL
NULL
NULL
3
7
575
8
NULL
2349
49
17913
true
NULL
NULL
NULL
7
8
964
7
NULL
3164
50
14518
true
NULL
NULL
NULL
7
9
77
7
NULL
1153
51
17577
true
NULL
NULL
NULL
7
10
191
20
NULL
1381
52
18030
true
NULL
NULL
NULL
7
11
586
3
NULL
2371
53
17639
true
NULL
NULL
NULL
7
12
529
15
NULL
2257
54
10941
true
NULL
NULL
NULL
7
13
473
13
NULL
2145
55
16374
true
NULL
NULL
NULL
7
14
870
8
NULL
3070
56
17521
true
NULL
NULL
NULL
7
15
991
3
3
3191
NULL
11911
true
NULL
NULL
NULL
3
16
414
2
NULL
2027
57
10690
true
NULL
NULL
NULL
7
17
910
8
NULL
3110
58
10255
true
NULL
NULL
NULL
7
18
423
2
4
2045
NULL
13260
true
NULL
NULL
NULL
4
19
949
7
NULL
3149
59
16825
true
NULL
NULL
NULL
7
20
973
14
NULL
3173
60
12227
true
NULL
NULL
NULL
7
21
463
6
4
2125
NULL
16070
true
NULL
NULL
NULL
4
22
884
13
NULL
3084
61
16793
true
NULL
NULL
NULL
7
23
173
7
NULL
1345
62
12467
true
NULL
NULL
NULL
7
24
890
16
3
3090
NULL
13700
true
NULL
NULL
NULL
3
25
189
15
NULL
1377
63
11503
true
NULL
NULL
NULL
7