SQL Tables

Customers
UserID
Int
Primary Key
Name
VarChar(50)

State
Char(2)

StockOrders
UserId
Integer
Foreign Key References Customers
StockId
Integer
Foreign Key references Stocks
Day
Date
Foreign Key references Stockprices(Day)
Price
Numeric(10,2)
> 0.0
Shares
Integer
> 0
Commission
Numeric(10,2)
Not Null
Total
Numeric(10,2)
= Price * Shares + Commission
Flag
Char
Must be 'b' or 's'

StockPrices
StockID
Int
Foreign Key references Stocks, Not Null
Day
Date

Low
Numeric(10,2)
< = High
High
Numeric(10,2)
> = Low
Close
Numeric(10,2)
<= High and >= Low
Stocks
StockID
Int
PrimaryKey
StockName
VarChar(25)

Symbol
Char(4)