Order Details

Transact-SQL Reference

Transact-SQL Reference

Order Details

Column_name Data type Nullable Default Check Key/index
OrderID int no Composite PK, clust1, FK
Orders(OrderID)2
ProductID int no Composite PK, clust1, FK
Products(ProductID)3
UnitPrice money no 0 yes4
Quantity smallint no 1 yes5
Discount real no 0

1  The composite, primary key, clustered index is defined on OrderID and ProductID.
2  There are also two nonclustered indexes on OrderID.
3  There are also two  nonclustered indexes on ProductID.
4  The UnitPrice CHECK constraint is defined as (UnitPrice >= 0).
5  The Quantity CHECK constraint is defined as (Quantity > 0).
The table-level CHECK constraint is defined as (Discount >= 0 and Discount < = 1).