Database table for exchange rates
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
2
down vote
favorite
I want to create a table in my database to store the exchange rates for currencies so I don't have to make an api call every time.
My table has the following structure:
from_currency
to_currency
rate
If I have 170 currencies the table will have 170 * 170 (~29.000) entries. This seems a bit much for me. Is this the normal way to store exchange rates?
database-design
New contributor
sascha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
2
down vote
favorite
I want to create a table in my database to store the exchange rates for currencies so I don't have to make an api call every time.
My table has the following structure:
from_currency
to_currency
rate
If I have 170 currencies the table will have 170 * 170 (~29.000) entries. This seems a bit much for me. Is this the normal way to store exchange rates?
database-design
New contributor
sascha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I want to create a table in my database to store the exchange rates for currencies so I don't have to make an api call every time.
My table has the following structure:
from_currency
to_currency
rate
If I have 170 currencies the table will have 170 * 170 (~29.000) entries. This seems a bit much for me. Is this the normal way to store exchange rates?
database-design
New contributor
sascha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I want to create a table in my database to store the exchange rates for currencies so I don't have to make an api call every time.
My table has the following structure:
from_currency
to_currency
rate
If I have 170 currencies the table will have 170 * 170 (~29.000) entries. This seems a bit much for me. Is this the normal way to store exchange rates?
database-design
database-design
New contributor
sascha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
sascha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
sascha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 5 hours ago
sascha
1133
1133
New contributor
sascha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
sascha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
sascha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
There isn't really anything wrong with that design, its almost exactly what our production fact table looks like so you aren't far off. 29,000 rows isn't that many these days.
Here is the structure that we use in our master warehouse:
CREATE TABLE Fact.ExchangeRates
(
TradingDate DATE NOT NULL,
SourceCurrency CHAR(3) NOT NULL,
TargetCurrency CHAR(3) NOT NULL,
ClosingRate DECIMAL(9,2) NOT NULL,
AverageRate DECIMAL(9,2) NOT NULL
);
Then, we have a fact table in each of our client data warehouse's that is built from the master. The data warehouses are set to use a single base currency so we can eliminate the source currency:
CREATE TABLE Fact.ExchangeRates
(
DateKey DATE NOT NULL REFERENCES Dimension."Date"(DateKey),
CurrencyKey CHAR(3) NOT NULL REFERENCES Dimension.Currency(CurrencyKey),
ClosingRate DECIMAL(9,2) NOT NULL,
AverageRate DECIMAL(9,2) NOT NULL
);
1
Thanks for the great answer.
– sascha
4 hours ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
There isn't really anything wrong with that design, its almost exactly what our production fact table looks like so you aren't far off. 29,000 rows isn't that many these days.
Here is the structure that we use in our master warehouse:
CREATE TABLE Fact.ExchangeRates
(
TradingDate DATE NOT NULL,
SourceCurrency CHAR(3) NOT NULL,
TargetCurrency CHAR(3) NOT NULL,
ClosingRate DECIMAL(9,2) NOT NULL,
AverageRate DECIMAL(9,2) NOT NULL
);
Then, we have a fact table in each of our client data warehouse's that is built from the master. The data warehouses are set to use a single base currency so we can eliminate the source currency:
CREATE TABLE Fact.ExchangeRates
(
DateKey DATE NOT NULL REFERENCES Dimension."Date"(DateKey),
CurrencyKey CHAR(3) NOT NULL REFERENCES Dimension.Currency(CurrencyKey),
ClosingRate DECIMAL(9,2) NOT NULL,
AverageRate DECIMAL(9,2) NOT NULL
);
1
Thanks for the great answer.
– sascha
4 hours ago
add a comment |Â
up vote
2
down vote
accepted
There isn't really anything wrong with that design, its almost exactly what our production fact table looks like so you aren't far off. 29,000 rows isn't that many these days.
Here is the structure that we use in our master warehouse:
CREATE TABLE Fact.ExchangeRates
(
TradingDate DATE NOT NULL,
SourceCurrency CHAR(3) NOT NULL,
TargetCurrency CHAR(3) NOT NULL,
ClosingRate DECIMAL(9,2) NOT NULL,
AverageRate DECIMAL(9,2) NOT NULL
);
Then, we have a fact table in each of our client data warehouse's that is built from the master. The data warehouses are set to use a single base currency so we can eliminate the source currency:
CREATE TABLE Fact.ExchangeRates
(
DateKey DATE NOT NULL REFERENCES Dimension."Date"(DateKey),
CurrencyKey CHAR(3) NOT NULL REFERENCES Dimension.Currency(CurrencyKey),
ClosingRate DECIMAL(9,2) NOT NULL,
AverageRate DECIMAL(9,2) NOT NULL
);
1
Thanks for the great answer.
– sascha
4 hours ago
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
There isn't really anything wrong with that design, its almost exactly what our production fact table looks like so you aren't far off. 29,000 rows isn't that many these days.
Here is the structure that we use in our master warehouse:
CREATE TABLE Fact.ExchangeRates
(
TradingDate DATE NOT NULL,
SourceCurrency CHAR(3) NOT NULL,
TargetCurrency CHAR(3) NOT NULL,
ClosingRate DECIMAL(9,2) NOT NULL,
AverageRate DECIMAL(9,2) NOT NULL
);
Then, we have a fact table in each of our client data warehouse's that is built from the master. The data warehouses are set to use a single base currency so we can eliminate the source currency:
CREATE TABLE Fact.ExchangeRates
(
DateKey DATE NOT NULL REFERENCES Dimension."Date"(DateKey),
CurrencyKey CHAR(3) NOT NULL REFERENCES Dimension.Currency(CurrencyKey),
ClosingRate DECIMAL(9,2) NOT NULL,
AverageRate DECIMAL(9,2) NOT NULL
);
There isn't really anything wrong with that design, its almost exactly what our production fact table looks like so you aren't far off. 29,000 rows isn't that many these days.
Here is the structure that we use in our master warehouse:
CREATE TABLE Fact.ExchangeRates
(
TradingDate DATE NOT NULL,
SourceCurrency CHAR(3) NOT NULL,
TargetCurrency CHAR(3) NOT NULL,
ClosingRate DECIMAL(9,2) NOT NULL,
AverageRate DECIMAL(9,2) NOT NULL
);
Then, we have a fact table in each of our client data warehouse's that is built from the master. The data warehouses are set to use a single base currency so we can eliminate the source currency:
CREATE TABLE Fact.ExchangeRates
(
DateKey DATE NOT NULL REFERENCES Dimension."Date"(DateKey),
CurrencyKey CHAR(3) NOT NULL REFERENCES Dimension.Currency(CurrencyKey),
ClosingRate DECIMAL(9,2) NOT NULL,
AverageRate DECIMAL(9,2) NOT NULL
);
answered 4 hours ago
Mr.Brownstone
8,50422041
8,50422041
1
Thanks for the great answer.
– sascha
4 hours ago
add a comment |Â
1
Thanks for the great answer.
– sascha
4 hours ago
1
1
Thanks for the great answer.
– sascha
4 hours ago
Thanks for the great answer.
– sascha
4 hours ago
add a comment |Â
sascha is a new contributor. Be nice, and check out our Code of Conduct.
sascha is a new contributor. Be nice, and check out our Code of Conduct.
sascha is a new contributor. Be nice, and check out our Code of Conduct.
sascha is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f221182%2fdatabase-table-for-exchange-rates%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password