Storage of 0.00001 in MySQL

I have a website for making money, and I would like the user to earn 0.00001 per click (I know this under 1p).

What type of column could I use? I tried intand floatbut does not work.

+3
source share
4 answers

Use DECIMALfor exact values.

The number 0.00001has 6 digits. 1 before and 5 after the decimal point. Therefore, it will be represented as DECIMAL(6, 5)(6 digits, 5 of which are after the decimal point). If you want to have, say, 4 digits before and 5 digits after the decimal point, you should use DECIMAL(9, 5)(total 9, of which 5 are after the decimal point).

See also:

+12

INT 100000 .

+4
+2

Try using a decimal column type with a value of (9.5), where 9 is the total number of digits (before and after the decimal place), and 5 is the number of digits after the decimal place. For more information about this type of column, see the MySql documentation page:

http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html

+1
source

All Articles