mysql - Vague SQL error... what's going on here? -
i'm getting error mysql useless error message i've ever seen:
error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near 'not null, primary key (userid, tweetid), foreign key (userid) references user(' @ line 4
great, check manual... >__>
here's sql source; i'm sure exceedingly simple familiar sql, i'm newb. me looks fine.
i'd have more well-formed question "what's error," error message vague, , me having little experience, i'm pretty lost.
create table user ( username varchar(20) not null, userid integer not null, fullname varchar(100), passwordhash varchar(256) not null, email varchar(256) not null, imageurl varchar(200), facebookurl varchar(200), tagline varchar(140), membersince timestamp not null, primary key (userid) ); create table tweet ( tweetid integer not null, userid integer not null, content varchar(140) not null, timestamp not null, primary key (tweetid), foreign key (userid) references user(userid) ); create table hashtag ( tweetid integer not null, content varchar(140) not null, primary key (content), foreign key (tweetid) references tweet(tweetid) ); create table follows ( follower integer not null, followee integer not null, primary key (follower, followee), foreign key (follower) references user(userid), foreign key (followee) references user(userid) ); create table retweets ( tweetid integer not null, userid integer not null, timestamp not null, primary key (userid, tweetid), foreign key (userid) references user(userid), foreign key (tweetid) references tweet(tweetid) ); create table mentions ( tweetid integer not null, userid integer not null, primary key (tweetid, userid), foreign key (tweetid) references tweet(tweetid), foreign key (userid) references user(userid) ); create table favorites ( tweetid integer not null, userid integer not null, primary key (tweetid, userid), foreign key (tweetid) references tweet(tweetid), foreign key (userid) references user(userid) ); create table cansee ( tweetid integer not null, userid integer not null, primary key (tweetid, userid), foreign key (tweetid) references tweet(tweetid), foreign key (userid) references user(userid) ); create table message ( messageid integer not null, senderid integer not null, receiverid integer not null, content varchar(140) not null, timestamp not null, primary key (messageid), foreign key (senderid) references user(userid), foreign key (receiverid) references user(userid) );
when says "near __" it's saying right before point triggered error.
in case, that's word timestamp
. listed timestamp
type column, never gave name. perhaps should modified_on timestamp
(or effect).
Comments
Post a Comment