我一直在尝试不同格式的查询,但我不知道为什么会出现这种奇怪的错误。
insert into details ('refno','membershipno','name','dob','year_of_passing_diploma','phone','address','email','mobileno','city','state','pincode','degree','college') values('1001','2001','ragesh','1991-06-27','2012','24423021','D1, silver star apartments sec','rageshcv@gmail.com','9840526989','chennai','tamil nadu','600020','pilot','newzeleand','98455 27/06/14','IOB chennai','Chetta kadai','nandanam','leatrher','MD','3','24405158','chennai')
我在这个查询中没有发现任何错误,但我仍然收到错误
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 ''refno','membershipno','name','dob','year_of_passing_diploma','phone','address',' at line 1
有没有人遇到过同样的问题?
答案 0 :(得分:4)
您不能在列标识符周围使用单引号。要么使用刻度,要么不使用:
insert into details (refno,membershipno,name,dob,year_of_passing_diploma,phone,address,email,mobileno,city,state,pincode,degree,college) values('1001','2001','ragesh','1991-06-27','2012','24423021','D1, silver star apartments sec','rageshcv@gmail.com','9840526989','chennai','tamil nadu','600020','pilot','newzeleand','98455 27/06/14','IOB chennai','Chetta kadai','nandanam','leatrher','MD','3','24405158','chennai')
或
insert into details (`refno`,`membershipno`,`name`,`dob`,`year_of_passing_diploma`,`phone`,`address`,`email`,`mobileno`,`city`,`state`,`pincode`,`degree`,`college`) values('1001','2001','ragesh','1991-06-27','2012','24423021','D1, silver star apartments sec','rageshcv@gmail.com','9840526989','chennai','tamil nadu','600020','pilot','newzeleand','98455 27/06/14','IOB chennai','Chetta kadai','nandanam','leatrher','MD','3','24405158','chennai')
答案 1 :(得分:2)
除了引用:您的查询中有14列和23个值
答案 2 :(得分:1)
单引号('
)用于表示字符串文字。在引用列时,您应该使用前向引号,或者根本不使用引号:
insert into details
(refno,membershipno,name,dob,year_of_passing_diploma,phone,address,email,mobileno,city,state,pincode,degree,college)
values('1001','2001','ragesh','1991-06-27','2012','24423021','D1, silver star apartments sec','rageshcv@gmail.com','9840526989','chennai','tamil nadu','600020','pilot','newzeleand','98455 27/06/14','IOB chennai','Chetta kadai','nandanam','leatrher','MD','3','24405158','chennai')