I have an earn site and I would like the user to earn 0.00001 per click (I know it's under 1p).
What type of column could I use? I have tried int
and float
but neither works.
MySQL permits a nonstandard syntax: FLOAT( M , D ) or REAL( M , D ) or DOUBLE PRECISION( M , D ) . Here, ( M , D ) means than values can be stored with up to M digits in total, of which D digits may be after the decimal point. For example, a column defined as FLOAT(7,4) is displayed as -999.9999 .
Yes, it is generally best practice to avoid giving your objects names that are keywords (reserved or not).
Use DECIMAL
for exact values.
The number 0.00001
has 6 digits. 1 before and 5 after the decimal point. Therefore, it would be represented as DECIMAL(6, 5)
(6 digits out of which 5 are after the decimal point). If you would like to have, say, 4 digits before and 5 digits after the decimal point, you'd use DECIMAL(9, 5)
(9 in total, out of which 5 are after the decimal point).
Also see:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With