0

I'm new to MySQL and am trying to create a simple table, but I'm getting the following error:

Error Code: 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 '{ Movie_ID int, Title varchar(60), Genre varchar(30), Director varchar(30), Star' at line 1

Here is my code:

CREATE TABLE Movies {
Movie_ID int,
Title varchar(60),
Genre varchar(30),
Director varchar(30),
Star varchar(30),
ReleaseDate year(),
Grade int,
Rating varchar(5),
};

I tried Googling MySQL 6.1 manual, but couldn't find what I needed.

1
  • 2
    Dont you mean mysql Workbench 6.1? Commented Jun 12, 2014 at 0:22

1 Answer 1

1

Table declarations use parenthesis, not brackets:

CREATE TABLE Movies (
    Movie_ID int,
    Title varchar(60),
    Genre varchar(30),
    Director varchar(30),
    Star varchar(30),
    ReleaseDate year(),
    Grade int,
    Rating varchar(5)
);
Sign up to request clarification or add additional context in comments.

4 Comments

Ah Okay thanks. Now it's saying my last line is incorrect. is using ');' not right?
Get rid of the last comma after Rating varchar(5)
Perfect. Thanks for helping with my stupid mistakes.
@Brett, also I think year() should be changed to year or year(4)

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.