What's wrong with my SQL code? Getting an error on line 9 -
i'm trying import code below mysql database. says have error on line 9 involving ')' token. idea how fix it? error message is:
you have error in sql syntax; check manual corresponds mysql server version right syntax use near ')' @ line 9
have error in sql syntax; check manual corresponds mysql server version right syntax use near ')' @ line 6
have error in sql syntax; check manual corresponds mysql server version right syntax use near ')' @ line 10
create table user_types ( id int unsigned not null primary key auto_increment, name varchar(64), description varchar(255), rank int unsigned not null default 1 ); create table users ( id int unsigned not null primary key auto_increment, username varchar(64), email varchar(64) not null, password varchar(255) not null, ip_address varchar(255), user_agent varchar(255), type int unsigned not null default 1, first_name varchar(64), last_name varchar(64), biography text, dob_month int unsigned, dob_year int unsigned, dob_day int unsigned, interests varchar(255), gender varchar(64), created int unsigned not null ); create table sessions ( id int unsigned not null primary key auto_increment, user_id int unsigned not null, ip_address varchar(255), user_agent varchar(255), created int unsigned not null, last_activity int unsigned not null default 0 );
several create table
statements have trailing comma after last column, should removed.
for example:
create table announcements ( id int unsigned not null primary key auto_increment, user_id int unsigned not null, title varchar(255), content text, labels varchar(255), created int unsigned not null, archived int(1) not null default 0, );
should be:
create table announcements ( id int unsigned not null primary key auto_increment, user_id int unsigned not null, title varchar(255), content text, labels varchar(255), created int unsigned not null, archived int(1) not null default 0 );
with these changes schema building on sql fiddle.
Comments
Post a Comment