Properties

Owner: dbo 
Creation Date: 08/06/2000 
Located On: PRIMARY 
Data Size KB: 72 
Index Size KB: 208 
Rows: 2155 
Description:  

Columns

Name Data Type Length NULL Default IsIdentity IsGUID Description
    OrderID  int           
    ProductID  int           
    UnitPrice  money    (0)       
    Quantity  smallint    (1)       
    Discount  real    (0)       
Total: 5 column(s)

Indexes

Index Primary Unique Description
  PK_Order_Details       
  OrderID       
  OrdersOrder_Details       
  ProductID       
  ProductsOrder_Details       
Total: 5 index(es)

Check Constraints

Name Expression
  CK_Discount  ([Discount] >= 0 and [Discount] <= 1) 
  CK_Quantity  ([Quantity] > 0) 
  CK_UnitPrice  ([UnitPrice] >= 0) 
Total: 3 constraint(s)

Referenced Tables

Table Foreign Key Primary Key or Unique Constraint
  dbo.Orders  FK_Order_Details_Orders  PK_Orders 
  dbo.Products  FK_Order_Details_Products  PK_Products 
Total: 2 table(s)

Objects that [dbo].[Order Details] depends on

Object Name Owner Object Type Dep Level
  Categories  dbo  Table 
  Customers  dbo  Table 
  Employees  dbo  Table 
  Shippers  dbo  Table 
  Suppliers  dbo  Table 
  Orders  dbo  Table 
  Products  dbo  Table 
Total: 7 object(s)

Objects that depend on [dbo].[Order Details]

Object Name Owner Object Type Dep Level
  Invoices  dbo  View 
  Order Details Extended  dbo  View 
  Order Subtotals  dbo  View 
  Product Sales for 1997  dbo  View 
  CustOrderHist  dbo  Procedure 
  CustOrdersDetail  dbo  Procedure 
  SalesByCategory  dbo  Procedure 
  Category Sales for 1997  dbo  View 
  Sales by Category  dbo  View 
  Sales Totals by Amount  dbo  View 
  Summary of Sales by Quarter  dbo  View 
  Summary of Sales by Year  dbo  View 
  Employee Sales by Country  dbo  Procedure 
  Sales by Year  dbo  Procedure 
Total: 14 object(s)

SQL

CREATE TABLE [Order Details] (
    [OrderID] [int] NOT NULL ,
    [ProductID] [int] NOT NULL ,
    [UnitPrice] [money] NOT NULL CONSTRAINT [DF_Order_Details_UnitPrice] DEFAULT (0),
    [Quantity] [smallint] NOT NULL CONSTRAINT [DF_Order_Details_Quantity] DEFAULT (1),
    [Discount] [real] NOT NULL CONSTRAINT [DF_Order_Details_Discount] DEFAULT (0),
    CONSTRAINT [PK_Order_Details] PRIMARY KEY  CLUSTERED
    (
        [OrderID],
        [ProductID]
    )  ON [PRIMARY] ,
    CONSTRAINT [FK_Order_Details_Orders] FOREIGN KEY
    (
        [OrderID]
    ) REFERENCES [Orders] (
        [OrderID]
    ),
    CONSTRAINT [FK_Order_Details_Products] FOREIGN KEY
    (
        [ProductID]
    ) REFERENCES [Products] (
        [ProductID]
    ),
    CONSTRAINT [CK_Discount] CHECK ([Discount] >= 0 and [Discount] <= 1),
    CONSTRAINT [CK_Quantity] CHECK ([Quantity] > 0),
    CONSTRAINT [CK_UnitPrice] CHECK ([UnitPrice] >= 0)
) ON [PRIMARY]
GO


See Also

List of tables