错误代码:#1064 MySQL 查询

Error code : #1064 MySQL Query

错误陈述:

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 ;

括号前多了一个逗号

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 ;

您需要删除第 5 行末尾多余的逗号 (,)。 SQL 应该是这样的:

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 ;