Error in my SQL syntax on SQL Fiddle

844 views Asked by At

I'm new to sql programming. For a computer science project I am trying to apply my knowledge of sql in some way. On SQL Fiddle, I am using the MySQL 5.6 database and I am having so much trouble building schema. This is what it keeps telling me:

"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 '[ Name varchar[15], Description varchar[50], Ranking int, ]' at line 2"

I need help either learning how to use SQL Fiddle or how to build my schema. Thanks and my code is below.

CREATE TABLE food
(
    Name varchar(15),
    Description varchar(50),
    Ranking int,
); 
insert into food
values ('Watermelon', 'A yummy fruit', 9);
1

There are 1 answers

1
jbg On BEST ANSWER

you have a comma after Ranking int.

Corrected Code:

CREATE TABLE food ( Name varchar(15), Description varchar(50), Ranking int ); 
INSERT INTO food values ('Watermelon', 'A yummy fruit', 9);