mHelpMe
mHelpMe

Reputation: 6668

to have one table or split into two tables

I have to download some daily financial prices for approx 10,000 securities. The prices will start from 1980 until today. I have to download the prices in USD and in their local currency.

My question is whether to have two tables like below, one for the USD prices and the other for the local currency. Or should I add a field, Currency nvarchar(3) to my table below. Which is the better practise?

   datePrice date
   id   nvarchar(11)
   price float

Upvotes: 0

Views: 72

Answers (1)

Jamiec
Jamiec

Reputation: 136239

Don't go with 2 tables - thats just a bad solution all round.

I'd also suggest adding a varchar(3) field is also a bad solution, as you'll end up with a lot of duplication.

If you're absolutely sure you'll only ever have 2 currencies then 2 fields in your one table will suffice (usdPrice, localPrice).

However the more scalable solution is a security table (Id/Other info) and a reference table which stores a foreign key back to the securityId, a foreign key to the currencyId, the date and the price

Upvotes: 1

Related Questions