Unable to execute command: MySQL
NickName:Lai Mom Cin Ask DateTime:2017-06-12T05:22:32

Unable to execute command: MySQL

create table `payrollmanagementsystem`.DEDUCTION
(
    CODE VARCHAR(50) not null primary key,
    NAME VARCHAR(50),
    SALARYPERDAY DOUBLE PRECISION,
    LEAVE INT,
    KWSP DOUBLE PRECISION,
    TOTALDEDUCTION DOUBLE PRECISION
)

I had face the problem with unable to execute command as error below:

Unable to execute command:
create table `payrollmanagementsystem`.DEDUCTION
(
    CODE VARCHAR(50) not null primary key,
    NAME VARCHAR(50),
    SALARYPERDAY DOUBLE PRECISION,
    LEAVE INT,
    KWSP DOUBLE PRECISION,
    TOTALDEDUCTION DOUBLE PRECISION
)
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 'LEAVE INT,
    KWSP DOUBLE PRECISION,
    TOTALDEDUCTION DOUBLE PRECISION
)' at line 6

Copyright Notice:Content Author:「Lai Mom Cin」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/44488903/unable-to-execute-command-mysql

Answers
Gulzt 2017-06-11T21:38:32

As others pointed out, LEAVE is a keyword. To solve your problem, use backticks:\n\n`LEAVE` INT,\n\n\nBe aware that CODE is a keyword as well, though in this case it won't cause a problem. It's still good practice to escape your column names.",


More about “Unable to execute command: MySQL” related questions