Database table for exchange rates

The name of the pictureThe name of the pictureThe name of the pictureClash 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?










share|improve this question







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.

























    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?










    share|improve this question







    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.





















      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?










      share|improve this question







      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






      share|improve this question







      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.











      share|improve this question







      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.









      share|improve this question




      share|improve this question






      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.




















          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
          );





          share|improve this answer
















          • 1




            Thanks for the great answer.
            – sascha
            4 hours ago










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "182"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          sascha is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          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






























          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
          );





          share|improve this answer
















          • 1




            Thanks for the great answer.
            – sascha
            4 hours ago














          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
          );





          share|improve this answer
















          • 1




            Thanks for the great answer.
            – sascha
            4 hours ago












          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
          );





          share|improve this answer












          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
          );






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 4 hours ago









          Mr.Brownstone

          8,50422041




          8,50422041







          • 1




            Thanks for the great answer.
            – sascha
            4 hours ago












          • 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










          sascha is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          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.













           


          draft saved


          draft discarded














          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













































































          Comments

          Popular posts from this blog

          List of Gilmore Girls characters

          What does second last employer means? [closed]

          One-line joke