0

Perhaps I'm just too used to Postgres but why am I getting this error

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 int not null AUTO_INCREMENT, email varchar(100) not null, primary key(id' at line 1

when I run this?

create table `users`{
    id int not null AUTO_INCREMENT,
    email varchar(100) not null,
    primary key(id)
};
3
  • 4
    Use parentheses CREATE TABLE Users ( ... ) not braces CREATE TABLE Users { ... }. Commented Apr 4, 2014 at 21:10
  • 1
    Use () at the place of {} Commented Apr 4, 2014 at 21:11
  • 1
    That syntax isn't valid for Postgres either. Commented Apr 4, 2014 at 22:47

2 Answers 2

2

Use parenthesis (normal brackets) () not braces:

create table `users` (
    id int not null AUTO_INCREMENT,
    email varchar(100) not null,
    primary key(id)
);
Sign up to request clarification or add additional context in comments.

Comments

1

the correct syntax is :

CREATE TABLE users (
id INT NOT NULL AUTO_INCREMENT,
email VARCHAR(100) NOT NULL,
PRIMARY KEY(id) );

check it out here for your version:

https://dev.mysql.com/doc/refman/4.1/en/creating-tables.html

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.