Hi,
I'm trying to store stock data in a data base. All stocks will store the date, open, high, low, close. Some stocks may also have additional information stored such as P/E ratios and Debt/Equity ratios. When I first thought of this, I figured I would store the data in a few tables and have it without nulls
Table
ataTypes (this would be Open, high, low, close, p/e, ratios, etc)
DataTypeID
Name
Table
ata
FK_StockQuoteID
FK_DataTypeID
Value
Table:StockQuotes
FK_StockID
Date
So, in this case, only the data that is available for each stock is stored. However, the more I look at this design, the more I think it is stupid. Having nulls in a table is not such a bad thing. Does something like this flat table make more sense?
Table:Quotes
(pk)FK_StockID
(pk)Date
Open
High
Low
Close
Table:ExtendedQuotes (all possible values that may be stored for the stock. Some will be null)
(pk)FK_StockID
(pk)Date
PE
DebtEquity
etc
Note that new quotes will come in many times each day.
I'm trying to store stock data in a data base. All stocks will store the date, open, high, low, close. Some stocks may also have additional information stored such as P/E ratios and Debt/Equity ratios. When I first thought of this, I figured I would store the data in a few tables and have it without nulls
Table
DataTypeID
Name
Table
FK_StockQuoteID
FK_DataTypeID
Value
Table:StockQuotes
FK_StockID
Date
So, in this case, only the data that is available for each stock is stored. However, the more I look at this design, the more I think it is stupid. Having nulls in a table is not such a bad thing. Does something like this flat table make more sense?
Table:Quotes
(pk)FK_StockID
(pk)Date
Open
High
Low
Close
Table:ExtendedQuotes (all possible values that may be stored for the stock. Some will be null)
(pk)FK_StockID
(pk)Date
PE
DebtEquity
etc
Note that new quotes will come in many times each day.