views:

65

answers:

1

Hi,

I get an error when running the following create table:

CREATE TABLE Event (
    id  VARCHAR(10)         NOT NULL,
    title  VARCHAR(100),
    start_date DATE   NOT NULL,
    end_date DATE,
    description TEXT,
    url  VARCHAR(200),
    website  VARCHAR(200),
    location VARCHAR(32)  NOT NULL;
    PRIMARY KEY (id),
    FOREIGN KEY (location) REFERENCES Location(id)
);

The error I get is this:

#1064 - 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 9

I know that this error has to do with incompatibility with the syntax and the mysql version running, but I've checked every line and the syntax is correct according to the documentation. Am I missing something?

Thanks in advance for all your answers.

+3  A: 

Try changing the semicolon on line:

 location    VARCHAR(32)             NOT NULL;

to a comma.

Jeremy Smyth
Damn, now I feel like a complete noob. How was I missing that out? Thanks :)
rogeriopvl
Usually happens to me when I've been staring at the screen for too long. Do you have any trees you can stare at for 5 minutes? :)
Jeremy Smyth
Well, it's night over here in Portugal, so I'll just stare at the moon :)
rogeriopvl