Databases > AdventureWorks2019 > Tables > Sales.SalesOrderHeader

AdventureWorks2019

Sales.SalesOrderHeader

//
General sales order information.

Created: Modified:

Columns

  • //
    ${escapify(column.description)}
    SalesOrderID
    [int] IDENTITY (1,1) NOT NULL
  • //
    ${escapify(column.description)}
    RevisionNumber
    [tinyint] NOT NULL DEFAULT ((0))
  • //
    ${escapify(column.description)}
    OrderDate
    [datetime] NOT NULL DEFAULT (getdate())
  • //
    ${escapify(column.description)}
    DueDate
    [datetime] NOT NULL
  • //
    ${escapify(column.description)}
    ShipDate
    [datetime] NULL
  • //
    ${escapify(column.description)}
    Status
    [tinyint] NOT NULL DEFAULT ((1))
    //
    CONSTRAINT: Check constraint [Status] BETWEEN (0) AND (8)
    ([Status]>=(0) AND [Status]<=(8))
  • //
    ${escapify(column.description)}
    OnlineOrderFlag
    [Flag] NOT NULL DEFAULT ((1))
    //
    USER-DEFINED DATA TYPE
    [bit] NOT NULL
  • //
    ${escapify(column.description)}
    SalesOrderNumber
    [nvarchar](25) NOT NULL
  • //
    ${escapify(column.description)}
    PurchaseOrderNumber
    [OrderNumber] NULL
    //
    USER-DEFINED DATA TYPE
    [nvarchar](25) NULL
  • //
    ${escapify(column.description)}
    AccountNumber
    [AccountNumber] NULL
    //
    USER-DEFINED DATA TYPE
    [nvarchar](15) NULL
  • //
    ${escapify(column.description)}
    CustomerID
    [int] NOT NULL
  • //
    ${escapify(column.description)}
    SalesPersonID
    [int] NULL
  • //
    ${escapify(column.description)}
    TerritoryID
    [int] NULL
  • //
    ${escapify(column.description)}
    BillToAddressID
    [int] NOT NULL
  • //
    ${escapify(column.description)}
    ShipToAddressID
    [int] NOT NULL
  • //
    ${escapify(column.description)}
    ShipMethodID
    [int] NOT NULL
  • //
    ${escapify(column.description)}
    CreditCardID
    [int] NULL
  • //
    ${escapify(column.description)}
    CreditCardApprovalCode
    [varchar](15) NULL
  • //
    ${escapify(column.description)}
    CurrencyRateID
    [int] NULL
  • //
    ${escapify(column.description)}
    SubTotal
    [money] NOT NULL DEFAULT ((0.00))
    //
    CONSTRAINT: Check constraint [SubTotal] >= (0.00)
    ([SubTotal]>=(0.00))
  • //
    ${escapify(column.description)}
    TaxAmt
    [money] NOT NULL DEFAULT ((0.00))
    //
    CONSTRAINT: Check constraint [TaxAmt] >= (0.00)
    ([TaxAmt]>=(0.00))
  • //
    ${escapify(column.description)}
    Freight
    [money] NOT NULL DEFAULT ((0.00))
    //
    CONSTRAINT: Check constraint [Freight] >= (0.00)
    ([Freight]>=(0.00))
  • //
    ${escapify(column.description)}
    TotalDue
    [money] NOT NULL
  • //
    ${escapify(column.description)}
    Comment
    [nvarchar](128) NULL
  • //
    ${escapify(column.description)}
    rowguid
    [uniqueidentifier] NOT NULL DEFAULT (newid())
  • //
    ${escapify(column.description)}
    ModifiedDate
    [datetime] NOT NULL DEFAULT (getdate())

Indexes

  • //
    Clustered index created by a primary key constraint.
    PK_SalesOrderHeader_SalesOrderID
    UNIQUE CLUSTERED
    SalesOrderID
  • //
    Unique nonclustered index. Used to support replication samples.
    AK_SalesOrderHeader_rowguid
    UNIQUE NONCLUSTERED
    rowguid
  • //
    Unique nonclustered index.
    AK_SalesOrderHeader_SalesOrderNumber
    UNIQUE NONCLUSTERED
    SalesOrderNumber
  • //
    Nonclustered index.
    IX_SalesOrderHeader_CustomerID
    NONCLUSTERED
    CustomerID
  • //
    Nonclustered index.
    IX_SalesOrderHeader_SalesPersonID
    NONCLUSTERED
    SalesPersonID

Foreign Keys

  • //
    Foreign key constraint referencing Address.AddressID.
    FK_SalesOrderHeader_Address_BillToAddressID
    Person.Address
    BillToAddressID ⥱ AddressID
  • //
    Foreign key constraint referencing Address.AddressID.
    FK_SalesOrderHeader_Address_ShipToAddressID
    Person.Address
    ShipToAddressID ⥱ AddressID
  • //
    Foreign key constraint referencing CreditCard.CreditCardID.
    FK_SalesOrderHeader_CreditCard_CreditCardID
    Sales.CreditCard
    CreditCardID ⥱ CreditCardID
  • //
    Foreign key constraint referencing CurrencyRate.CurrencyRateID.
    FK_SalesOrderHeader_CurrencyRate_CurrencyRateID
    Sales.CurrencyRate
    CurrencyRateID ⥱ CurrencyRateID
  • //
    Foreign key constraint referencing Customer.CustomerID.
    FK_SalesOrderHeader_Customer_CustomerID
    Sales.Customer
    CustomerID ⥱ CustomerID
  • //
    Foreign key constraint referencing SalesPerson.SalesPersonID.
    FK_SalesOrderHeader_SalesPerson_SalesPersonID
    Sales.SalesPerson
    SalesPersonID ⥱ BusinessEntityID
  • //
    Foreign key constraint referencing SalesTerritory.TerritoryID.
    FK_SalesOrderHeader_SalesTerritory_TerritoryID
    Sales.SalesTerritory
    TerritoryID ⥱ TerritoryID
  • //
    Foreign key constraint referencing ShipMethod.ShipMethodID.
    FK_SalesOrderHeader_ShipMethod_ShipMethodID
    Purchasing.ShipMethod
    ShipMethodID ⥱ ShipMethodID

Check Constraints

  • //
    Check constraint [DueDate] >= [OrderDate]
    CK_SalesOrderHeader_DueDate
    ([DueDate]>=[OrderDate])
  • //
    Check constraint [ShipDate] >= [OrderDate] OR [ShipDate] IS NULL
    CK_SalesOrderHeader_ShipDate
    ([ShipDate]>=[OrderDate] OR [ShipDate] IS NULL)

Sample Data

SalesOrderID
RevisionNumber
OrderDate
DueDate
ShipDate
Status
OnlineOrderFlag
SalesOrderNumber
PurchaseOrderNumber
AccountNumber
CustomerID
SalesPersonID
TerritoryID
BillToAddressID
ShipToAddressID
ShipMethodID
CreditCardID
CreditCardApprovalCode
CurrencyRateID
SubTotal
TaxAmt
Freight
TotalDue
Comment
rowguid
ModifiedDate
43659
8
5
NULL
SO43659
PO522145787
10-4020-000676
29825
279
5
985
985
5
16281
105041Vi84182
NULL
20565.6206
1971.5149
616.0984
23153.2339
NULL
79B65321-39CA-4115-9CBA-8FE0903E12E6
43660
8
5
NULL
SO43660
PO18850127500
10-4020-000117
29672
279
5
921
921
5
5618
115213Vi29411
NULL
1294.2529
124.2483
38.8276
1457.3288
NULL
738DC42D-D03B-48A1-9822-F95A67EA7389
43661
8
5
NULL
SO43661
PO18473189620
10-4020-000442
29734
282
6
517
517
5
1346
85274Vi6854
4
32726.4786
3153.7696
985.553
36865.8012
NULL
D91B9131-18A4-4A11-BC3A-90B6F53E9D74
43662
8
5
NULL
SO43662
PO18444174044
10-4020-000227
29994
282
6
482
482
5
10456
125295Vi53935
4
28832.5289
2775.1646
867.2389
32474.9324
NULL
4A1ECFC0-CC3A-4740-B028-1C50BB48711C
43663
8
5
NULL
SO43663
PO18009186470
10-4020-000510
29565
276
4
1073
1073
5
4322
45303Vi22691
NULL
419.4589
40.2681
12.5838
472.3108
NULL
9B1E7A40-6AE0-4AD3-811C-A64951857C4B
43664
8
5
NULL
SO43664
PO16617121983
10-4020-000397
29898
280
1
876
876
5
806
95555Vi4081
NULL
24432.6088
2344.9921
732.81
27510.4109
NULL
22A8A5DA-8C22-42AD-9241-839489B6EF0D
43665
8
5
NULL
SO43665
PO16588191572
10-4020-000146
29580
283
1
849
849
5
15232
35568Vi78804
NULL
14352.7713
1375.9427
429.9821
16158.6961
NULL
5602C304-853C-43D7-9E79-76E320D476CF
43666
8
5
NULL
SO43666
PO16008173883
10-4020-000511
30052
276
4
1074
1074
5
13349
105623Vi69217
NULL
5056.4896
486.3747
151.9921
5694.8564
NULL
E2A90057-1366-4487-8A7E-8085845FF770
43667
8
5
NULL
SO43667
PO15428132599
10-4020-000646
29974
277
3
629
629
5
10370
55680Vi53503
NULL
6107.082
586.1203
183.1626
6876.3649
NULL
86D5237D-432D-4B21-8ABC-671942F5789D
43668
8
5
NULL
SO43668
PO14732180295
10-4020-000514
29614
282
6
529
529
5
1566
85817Vi8045
4
35944.1562
3461.7654
1081.8017
40487.7233
NULL
281CC355-D538-494E-9B44-461B36A826C6
43669
8
5
NULL
SO43669
PO14123169936
10-4020-000578
29747
283
1
895
895
5
15538
25877Vi80261
NULL
714.7043
70.5175
22.0367
807.2585
NULL
FABFC5C2-E034-4E0E-A573-6F39E9FA0484
43670
8
5
NULL
SO43670
PO14384116310
10-4020-000504
29566
275
3
810
810
5
18017
105888Vi93490
NULL
6122.082
587.5603
183.6126
6893.2549
NULL
573E52A7-573F-40B6-B695-6F3D242E0C6D
43671
8
5
NULL
SO43671
PO13978119376
10-4020-000200
29890
283
1
855
855
5
13693
25904Vi70960
NULL
8128.7876
780.8136
244.0042
9153.6054
NULL
005FDA9D-62E1-4001-A4AC-A976A7905F94
43672
8
5
NULL
SO43672
PO13862153537
10-4020-000119
30067
282
6
464
464
5
3980
95915Vi20982
4
6124.182
587.6023
183.6257
6895.41
NULL
194202AA-8E15-4932-A2C4-7A7AC0713639
43673
8
5
NULL
SO43673
PO13775141242
10-4020-000618
29844
275
2
821
821
5
1417
35931Vi7271
NULL
3746.2015
357.9614
111.8629
4216.0258
NULL
C5CD3AE9-41F5-4B71-A3F1-D550B928572B
43674
8
5
NULL
SO43674
PO12760141756
10-4020-000083
29596
282
6
458
458
5
19204
26081Vi99806
4
2624.382
251.9407
78.7315
2955.0542
NULL
CE8BCA02-F705-4AAE-A446-5D8B660C3A1B
43675
8
5
NULL
SO43675
PO12412186464
10-4020-000670
29827
277
3
631
631
5
11886
126121Vi61402
NULL
5716.3102
546.8759
170.8987
6434.0848
NULL
9F2CF0EE-F2B8-44D4-897D-7641F4FBD649
43676
8
5
NULL
SO43676
PO11861165059
10-4020-000017
29811
275
5
755
755
5
18153
36168Vi94127
NULL
14203.458
1363.266
426.0206
15992.7446
NULL
28C73732-D2FD-4F0D-A9A8-0E53595235F6
43677
8
5
NULL
SO43677
PO11049174786
10-4020-000679
29824
278
6
556
556
5
14030
16302Vi72763
4
7793.1108
747.1011
233.4691
8773.681
NULL
95FAAF28-6495-40B0-9789-466B195F2F96
43678
8
5
NULL
SO43678
PO10817150168
10-4020-000203
29889
281
4
1021
1021
5
5093
66363Vi26658
NULL
9799.9243
942.074
294.3981
11036.3964
NULL
7F4B7542-638E-41CA-98D0-93018FE4DF77
43679
8
5
NULL
SO43679
PO10527142759
10-4020-000480
29761
278
6
525
525
5
5439
126365Vi28482
4
1316.0575
125.8032
39.3135
1481.1742
NULL
17D42D83-177D-4C7E-9C86-D2DB69326E04
43680
8
5
NULL
SO43680
PO10730130087
10-4020-000491
29489
281
4
1069
1069
5
6653
126370Vi34642
NULL
11397.4992
1093.6394
341.7623
12832.9009
NULL
9CBE5E7A-12D2-4DD4-B50C-1FFB4021C6E1
43681
8
5
NULL
SO43681
PO1189177803
10-4020-000423
29661
279
5
955
955
5
5301
16608Vi27707
NULL
13787.5434
1323.0668
413.4584
15524.0686
NULL
C82FC32F-7E10-40D2-8A9F-3D932DB42CD4
43682
8
5
NULL
SO43682
PO1566124200
10-4020-000486
29759
275
2
808
808
5
76
96712Vi373
NULL
3875.7229
371.8002
116.1876
4363.7107
NULL
CDC225D3-B639-4217-A7A4-3DED506FCEBE
43683
8
5
NULL
SO43683
PO2552113807
10-4020-000506
29497
283
1
889
889
5
13045
76866Vi67506
NULL
42813.4333
4107.1489
1283.484
48204.0662
NULL
F6E2ABB3-6FF8-49A6-9506-0B051A4618A0