Hi all,
I want to display 2 decimal places in mysql database.
Here's my query... insert into delivery values(NULL, "IRL", "10.00");
I set data type to DECIMAL but the above is stored as 10
Why is this?
Thanks.
Kevin.
I do not think it is not enough to specify the data field-type as decimal, but you must also specify the length prior to and after the decimal point.
So alter you table so the "length/values" is: 10,2 which means ten places before the decimal and two places AFTER the decimal.
Hope that helps.
Unless I am mistaken the length, decimal values for a DECIMAL data type are the length is the length of the number itself (inluding the decimal point) so 10,2 would give a number of 7 numbers to the left of the decimal then the decimal and then two decimal places, if you wanted ten on the right I think it should be 13,2. At least that is the way I take the length-decimal for DECIMAL.
Houdini is almost right - here's a quote from the manual:
For example, a DECIMAL(18,9) column has nine digits on either side of the decimal point