I setup a database/website recently where the members have points scored against them.
There are 3 points fields (corresponding to different activities). And the Sum of those 3 fields = their total points.
Initially, I understood they’d always be whole numbers not totally more than 30. So I set the point fields to INT
Now they need to be able to have quarter (.25) and half points (.5) assigned.
Am I best to change these points fields to FLOAT(2,2)?
I would use a
DECIMAL(4,2).4is the precision (the total number of digits);2is the scale (the number of digits to the right of the decimal point).From the MySQL Reference:
Alternately, you could just store an
intthat represents 4 times the “actual” score.Example:
4.25would be represented in the database as17.