I'm about to build a SQL table where I want to store currency orders. That means that I need to store how much I paid for a certain quantity, and the ratio between both quantities. So for example:
+-------------+--------------+-------+
| Quantity US | Quantity EUR | Ratio |
+-------------+--------------+-------+
| 250 | 200 | 1.25 |
+-------------+--------------+-------+
My question is: does it make sense to have a column storing a value that's always going to be the division between two columns, or is it a better practice to not store that in the DB and instead do the calculations every time I need the ratio?
Ratio = US / EUR
exactly in all cases no matter what? I could see a point to this if it's the former.Quantity US
andQuantity EUR
are user inputted so I guess that's another point in favor for not creating the extra column, since it makes sense that users may need to fix a previous typo.