Bryan
Bryan

Reputation: 3009

Creating table in MySQL Workbench 6.1

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.

Upvotes: 0

Views: 4097

Answers (1)

John Conde
John Conde

Reputation: 219894

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)
);

Upvotes: 1

Related Questions