Hasan Daghash
Hasan Daghash

Reputation: 1691

Mysql : syntax error after update mysql

please advice whats the error in this statement, this statement was working fine before the last update for mysql

CREATE TABLE `users` (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
                      username VARCHAR(50),
                      password VARCHAR(500) NOT NULL,
                      full_name VARCHAR(50),
                      is_author BOOLEAN DEFAULT  ,
                      UNIQUE INDEX (username));

thanks in advance

Upvotes: 0

Views: 28

Answers (1)

Lukasz Szozda
Lukasz Szozda

Reputation: 175556

Remove DEFAULT or set to value:

CREATE TABLE `users` (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
                      username VARCHAR(50),
                      `password` VARCHAR(500) NOT NULL,
                      full_name VARCHAR(50),
                      is_author BOOLEAN,  -- here or DEFAULT true/false
                      UNIQUE INDEX (username));

Also qoute password because it is keyword.

SqlFiddleDemo

Upvotes: 3

Related Questions