1

I'm trying to create a table. I think the specifications of the table should be pretty obvious from the command I'm running:

create table users{
    id mediumint unsigned not null auto_increment,
    username varchar(40) not null,
    sprinkles bigint unsigned not null,
    passhash binary(64) not null,
    passsalt binary(64) not null,
    x decimal(10,1),
    y decimal(10,1),
    primary key (id),
    unique key idx_unique_username (username)
} engine = INNODB DEFAULT character set = utf8 COLLATE = utf8_general_ci;

However, when I try entering that into MySQL, it gives me this error:

ERROR 1064 (42000): 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 '{
id mediumint unsigned not null auto_increment,
username varchar(40) not null,
' at line 1

My mysql version is Ver 14.14 Distrib 5.5.31, for debian-linux-gnu (x86_64) using readline 6.2

2 Answers 2

3

Begin with your parentheses shape.

Hint: find any create table example and compare to what you have

Hint 2: when mysql returns you a error about incorrect syntax - it points directly to the first token it couldn't parse. So your attention should be drawn to that exact character and some characters before it.

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

2 Comments

Oh God this is the most embarrassingly stupid question I've ever asked.
Re: Hint 2, when I edited the innards to try to figure it out, it actually cut off at seemingly random places. The token it ends on is "sprinkles", and it was moving around when I added things to the end of "username", for example. What was confusing me is that I wasn't at all focused on the beginning or end. Anyways, thanks for your help. I appreciate it.
0

Switch out the { } brackets you have encapsulating your table information, replace them with ( ) parentheses, and you should be good to go.

Comments

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.