MySQL Error #1064

0x60 picture 0x60 · Feb 21, 2011 · Viewed 26.2k times · Source

Running this SWL query keeps returning:

#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 ')' at line 20

CREATE TABLE users
(
    `a` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `b` VARCHAR(50) DEFAULT "USER",
    `c` INT(1) NOT NULL DEFAULT "0",
    `d` VARCHAR(30) NOT NULL,
    `e` VARCHAR(30) NOT NULL,
    `f` TEXT(30) NOT NULL,
    `g` TEXT(30) NOT NULL,
    `h` TEXT(30),
    `i` enum('i1','i2','i3') NOT NULL,
    `j` TEXT(60),
    `k` DATE NOT NULL,
    `l` VARCHAR(255) NOT NULL,
    `m` VARCHAR(255),
    `n` VARCHAR(255),
    `o` LONGTEXT NULL,
    `p` BLOB NULL,
    `q` VARCHAR(255) NOT NULL,
);

HELP!

Answer

Sarfraz picture Sarfraz · Feb 21, 2011

You should remove comma from the last entry:

CREATE TABLE users
(
    `a` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `b` VARCHAR(50) DEFAULT "USER",
    `c` INT(1) NOT NULL DEFAULT "0",
    `d` VARCHAR(30) NOT NULL,
    `e` VARCHAR(30) NOT NULL,
    `f` TEXT(30) NOT NULL,
    `g` TEXT(30) NOT NULL,
    `h` TEXT(30),
    `i` enum('i1','i2','i3') NOT NULL,
    `j` TEXT(60),
    `k` DATE NOT NULL,
    `l` VARCHAR(255) NOT NULL,
    `m` VARCHAR(255),
    `n` VARCHAR(255),
    `o` LONGTEXT NULL,
    `p` BLOB NULL,
    `q` VARCHAR(255) NOT NULL,  <--------------- this one
);