Syntax Error after adding FOREIGN KEY REFERENCE I'm getting the shown error in the code below, having copied the foreign key line stuff from the tutorial shown in the second image. Even after looking at this and other tutorials throughout the day I'm still not seeing where the problem is. Could someone please point out what's wrong?
Try:

...
poster int references user(userid)
...


E.g.

mysql&gt; create table user ( uname varchar(15) primary key ) ;
Query OK, 0 rows affected (0.01 sec)


mysql&gt; create table note (
    -&gt;   title int primary key
    -&gt; , poster int references user(userid)
    -&gt; );
Query OK, 0 rows affected (0.00 sec)


Or ...

alter table note
add constraint user_fk
foreign key (poster) references user(uname);


E.g.

mysql&gt; create table user ( uname varchar(15) primary key ) ;
Query OK, 0 rows affected (0.00 sec)

mysql&gt; create table note (
    -&gt;   title int primary key
    -&gt; , poster varchar(15)
    -&gt; );
Query OK, 0 rows affected (0.00 sec)

mysql&gt; alter table note
    -&gt; add constraint user_fk
    -&gt; foreign key (poster) references user(uname); 
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0