In the last episode (Jul 18), shantanu oak said:
> I am getting two different results for the same set of commands on
> two different versions of MySQL. Can anyone explain what the issue
> is?
>
> CREATE TABLE `testdecimal` (
> `rate` decimal(7,4) NOT NULL default '0.0000'
> ) ENGINE=MyISAM;
>
> INSERT INTO testdecimal SET rate=1468;
>
> select * from testdecimal;
> _____
>
> version 4.1.12
> 1468.0000
>
> version 5.0
> 999.9999
I think the DECIMAL type was changed to be more standard-compliant, and
(7,4) now means "7 total digits, 4 of them to the right of the decimal
point". Your number doesn't fit, so the maximum value was inserted
instead.
http://dev.mysql.com/doc/mysql/en/numeric-types.html
--
Dan Nelson
dnelson@stripped