0
votes
 CREATE TABLE info(id KEY AUTO_INCREMENT, email VARCHAR(20), name VARCHAR(20));

While using this code, in Ubuntu terminal, i am getting error like below

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 'KEY AUTO_INCREMENT, email VARCHAR(20), name VARCHAR(20))' at line 1

pls do help me for this problem. Thanks to replies in advance

3

3 Answers

0
votes

try this:

CREATE TABLE info(
    id int not null AUTO_INCREMENT, 
    email VARCHAR(20), 
    name VARCHAR(20),
    primary key(id)
);
0
votes

Try that:

 CREATE TABLE info(id INT NOT null  AUTO_INCREMENT, email VARCHAR(20), name VARCHAR(20),primary key(id));
0
votes

You have a problem with your "primary key" sintax on MySQL:

CREATE TABLE info(id not null AUTO_INCREMENT, email VARCHAR(20), name VARCHAR(20), Primary Key(id));