Designing database - help please.

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Bongulim
Forum Newbie
Posts: 21
Joined: Thu Aug 07, 2003 12:50 pm

Designing database - help please.

Post by Bongulim »

I intend to develope a database, to store stock prices...
I'll describe what I need first:
It's meant to stroe the prices for all stocks in the game, which is a trading simulation. the point is that there's a file on the server that contains current prices... I will interperate it and put the data in the database. the database should hold those prices' history.
I need a help on designing it. This is what I generally need:
A table that stores company ID and name
other tables that store the actual prices.
I have some ideas on that one...
#1
one table that contains columns COMPANYID|PRICE|TIMESTAMP.
#2
one table that have COMPANYID|PRICE|TSI
TSI is a short for time stamp index, which will be in another table:
Index|TIMESTAMP


On #1 and #2, the main table would contain info like this:
ID|PRICE|TSI or TIMESTAMP
---------------------------------
1|45.3|1 or 2000...
2|4445.6|1 or 2000...
3|5.343|1 or 2000...
1|46.3|2 or 2001...
2|4446.6|2 or 2001...
3|6.343|2 or 2001...

idea #3 is a different system not having prices table but a table for each company
ex.
company6 table:
PRICE|TSI

What idea would you suggest me to use? 1? 2? 3? another one?
TIA
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Some general advice here viewtopic.php?t=2996&highlight=database ... e1635341b6

You want to normalise the db as much as possible - sometimes you can compromise with that a bit. Sorry can't find any db normalisation links.
Bongulim
Forum Newbie
Posts: 21
Joined: Thu Aug 07, 2003 12:50 pm

Post by Bongulim »

what do you mean normalize it? and I didn't find anything there useful.
anyway, can anybody answer my specific questions? or give me some tips? it'd be great!
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Post Reply