Search code examples
mysqlmysql-error-1064

How to solve #1064 error in MySQL?


I got MySQL syntax Error 1064 while I am add new column.

ALTER TABLE `customerdetails` ADD `mobile` DOUBLE(12) NOT NULL ;

where customerdetails is the name of the table.

The Error message is " #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') NOT NULL' at line 1

Can somebody help me to solve this problem?


Solution

  • When you are defining column type as DOUBLE you have to define how many decimal places it will use

    ALTER TABLE customerdetails ADD mobile DOUBLE(12,2) NOT NULL ;
    

    Also first number (Characteristic) needs to be bigger than second number (Mantissa)