AdventureWorks2019
Production.WorkOrder
//
Manufacturing work orders.
Created: Modified:
Columns
-
//${escapify(column.description)}[int] IDENTITY (1,1) NOT NULL
-
//${escapify(column.description)}[int] NOT NULL
-
//${escapify(column.description)}[int] NOT NULL//CONSTRAINT: Check constraint [OrderQty] > (0)([OrderQty]>(0))
-
//${escapify(column.description)}[int] NOT NULL
-
//${escapify(column.description)}[smallint] NOT NULL//CONSTRAINT: Check constraint [ScrappedQty] >= (0)([ScrappedQty]>=(0))
-
//${escapify(column.description)}[datetime] NOT NULL
-
//${escapify(column.description)}[datetime] NULL
-
//${escapify(column.description)}[datetime] NOT NULL
-
//${escapify(column.description)}[smallint] NULL
-
//${escapify(column.description)}[datetime] NOT NULL DEFAULT (getdate())
Indexes
-
//Clustered index created by a primary key constraint.PK_WorkOrder_WorkOrderIDUNIQUE CLUSTEREDWorkOrderID
-
//Nonclustered index.IX_WorkOrder_ScrapReasonIDNONCLUSTEREDScrapReasonID
-
//Nonclustered index.IX_WorkOrder_ProductIDNONCLUSTEREDProductID
Foreign Keys
-
//Foreign key constraint referencing Product.ProductID.FK_WorkOrder_Product_ProductIDProduction.ProductProductID ⥱ ProductID
-
//Foreign key constraint referencing ScrapReason.ScrapReasonID.FK_WorkOrder_ScrapReason_ScrapReasonIDProduction.ScrapReasonScrapReasonID ⥱ ScrapReasonID
Check Constraints
-
//Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULLCK_WorkOrder_EndDate([EndDate]>=[StartDate] OR [EndDate] IS NULL)
Sample Data
WorkOrderID
ProductID
OrderQty
StockedQty
ScrappedQty
StartDate
EndDate
DueDate
ScrapReasonID
ModifiedDate
1
722
8
8
NULL
NULL
2
725
15
15
NULL
NULL
3
726
9
9
NULL
NULL
4
729
16
16
NULL
NULL
5
730
14
14
NULL
NULL
6
732
16
16
NULL
NULL
7
733
4
4
NULL
NULL
8
738
19
19
NULL
NULL
9
741
2
2
NULL
NULL
10
742
3
3
NULL
NULL
11
743
1
1
NULL
NULL
12
745
1
1
NULL
NULL
13
747
4
4
NULL
NULL
14
748
2
2
NULL
NULL
15
749
4
4
NULL
NULL
16
753
14
14
NULL
NULL
17
754
27
27
NULL
NULL
18
755
11
11
NULL
NULL
19
756
14
14
NULL
NULL
20
758
46
46
NULL
NULL
21
760
43
43
NULL
NULL
22
761
19
19
NULL
NULL
23
762
44
44
NULL
NULL
24
763
20
20
NULL
NULL
25
764
14
14
NULL
NULL