0

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.

1 Answer 1

3

Try changing the semicolon on line:

 location    VARCHAR(32)             NOT NULL;

to a comma.

Sign up to request clarification or add additional context in comments.

3 Comments

Damn, now I feel like a complete noob. How was I missing that out? Thanks :)
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? :)
Well, it's night over here in Portugal, so I'll just stare at the moon :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.