Order Details (T-SQL)

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    
1The composite, primary key, clustered index is defined on OrderID and ProductID.

2There are also two nonclustered indexes on OrderID.

3There are also two nonclustered indexes on ProductID.

4The UnitPrice CHECK constraint is defined as (UnitPrice >= 0).

5The Quantity CHECK constraint is defined as (Quantity > 0).

The table-level CHECK constraint is defined as (Discount >= 0 and Discount < = 1).


  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.