Search code examples
mysqlmysql-error-1064

Error code : #1064 MySQL Query


Error statement :

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 ') ENGINE = MEMORY' at line 6

CREATE TABLE abc (
srnum INT( 5 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
samay TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
lat VARCHAR( 255 ) NOT NULL ,
lon VARCHAR( 255 ) NOT NULL ,
) ENGINE = MEMORY ;

Solution

  • You need to remove the extra comma(,) from end of 5th line. The SQL should be like:

    CREATE TABLE abc ( 
        srnum INT( 5 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , 
        samay TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , 
        lat VARCHAR( 255 ) NOT NULL , 
        lon VARCHAR( 255 ) NOT NULL
    ) ENGINE = MEMORY ;