2016-04-26 54 views
-2

SQL ERROR: 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 1如何在MySQL中調試「你的SQL語法有錯誤」錯誤?

請幫我解決這個問題

create table post 
(
id bigint(20) primary key, 
content varchar(255) not null, 
date datetime not null, 
type_id bigint(20) not null, 
user_id bigint(20) not null, 
foreign key (type_id) references post_type(id), 
foreign key (user_id) references user(id), 
); 
+0

最後一行後刪除逗號,有何幫助? –

回答

-1

取出最後逗號

create table post 
(
    id bigint(20) primary key, 
    content varchar(255) not null, 
    date datetime not null, 
    type_id bigint(20) not null, 
    user_id bigint(20) not null, 
    foreign key (type_id) references post_type(id), 
    foreign key (user_id) references user(id) 
); 
+0

非常感謝你:) –

+0

大聲笑,那很容易賺錢;-) – PerlDuck