-2

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);
bumble_bee_tuna
  • 3,533
  • 7
  • 43
  • 83

1 Answers1

2

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);
bumble_bee_tuna
  • 3,533
  • 7
  • 43
  • 83
jbg
  • 476
  • 2
  • 9
  • 1
    Also, I'll advise not to use columns names like `Name` or `Description`. I'm not a MySql guy but I'll bet at least one of them is a reserved word. – Zohar Peled Jun 10 '15 at 17:27