Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Error #1064

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!

like image 816
0x60 Avatar asked Dec 10 '22 10:12

0x60


1 Answers

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
);
like image 199
Sarfraz Avatar answered Dec 19 '22 07:12

Sarfraz