0

While creating a table I'm getting following error

create table check(
id int(9) auto_increment,
test_case varchar(20),
file_name varchar(200),
coverage int(5),
primary key(test_case,file_name));

As I'm getting following 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 'check( id int(9) auto_increment,test_case varchar(20),file_name 
varchar(200),cov' at line 1
Dharman
  • 30,962
  • 25
  • 85
  • 135
vinay
  • 61
  • 1
  • 8

1 Answers1

1

There are 2 (possibly 3) errors, 1 Check is a reserved word either change it or enclose it in backticks, 2 id is auto_increment and must be defined as primary key, 3 defined primary is invalid because id has to be primary key.

create table `check`(
id int(9) auto_increment primary key,
test_case varchar(20),
file_name varchar(200),
coverage int(5),
 key k1(test_case,file_name));
P.Salmon
  • 17,104
  • 2
  • 12
  • 19