例如,一张表叫order(orderid,total)orderid是int型的primary key ,not null,unsigned并且auto_increment,total是double型。
SQL语句为:
INSERT INTO order(total) VALUES(19.99);
报错:
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 'order(total) VALUES(19.99)' at line 1
百思不得其解。请大家帮帮忙。

解决方案 »

  1.   

    mysql> create table `order` (orderid int unsigned primary key not null  auto_increment, total double);
    Query OK, 0 rows affected (0.09 sec)mysql> INSERT INTO order(total) VALUES(19.99);
    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 'order
    (total) VALUES(19.99)' at line 1-- 保留字加上反引号`
    mysql> INSERT INTO `order`(total) VALUES(19.99); 
    Query OK, 1 row affected (0.06 sec)mysql>
      

  2.   

    INSERT INTO `order`(`total`) VALUES(19.99);