Alter a table field from datatype float or double to decimal using sql prompt in phpmyadmin gui

Posted by: admin

As we know from mysql the datatype DECIMAL (M,D) has the below characteristics:

The declaration syntax for a DECIMAL column is DECIMAL(M,D). The ranges of values for the arguments in MySQL 5.1 are as follows:
- M is the maximum number of digits (the precision). It has a range of 1 to 65. (Older versions of MySQL allowed a range of 1 to 254.)
- D is the number of digits to the right of the decimal point (the scale). It has a range of 0 to 30 and must be no larger than M.

To alter the datatype from table eg. journals and field eg. amount in mysql prompt from phpmyadmin user interface we must type and run the below command

ALTER TABLE journals CHANGE amount amount DECIMAL (10,2)

The 10 is the total number of digits including the digits (here is 2 digits) right to point.
Thus an example for a decimal number is


About the Author