简体   繁体   中英

Exchange Rate SQL

I need to design in SQL Server a history archive exchange rate. In my program have to be able to access the values ​​of the exchange rate on the day x (x is the parameter).

The solution that I thought of is:

CREATE TABLE HISTORY (
Currency int, 
Value double, 
Date datetime) 

There are, in your opinion, a more effective and more efficient solution?

One thing that comes to my mind is datatypes.

Do not know what mssql version you are using but there are money and smallmoney data types that represent monetary or currency values and they take 8 or 4 bytes. I don't think exchange rate ever exceeds smallmoney range.

Unless you want to store rate changes during the day, there is no need of using datetime type. It takes 8 bytes while date takes only 3 bytes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM