在mysql的表里插入数据的时候,一直出现
insert into t_product (name,price) values('牛奶',5.2);
insert into t_product (name,price) value('方便面',4.5);
insert into t_product (name,price) value('矿区水',5);
insert into t_product (name,price) value('口香糖',2);
如下报错,卡了好久解决不了。
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 ',4.5)' at line
最后发现是中文输入法逗号和冒号的锅,报英文的,和 ;
输成中文的,和; 。
修改后就可以了
mysql> insert into t_product (name,price) values('牛奶',5.2); Query OK, 1 row affected (0.23 sec) mysql> insert into t_product (name,price) value('方便面',4.5); Query OK, 1 row affected (0.04 sec) mysql> insert into t_product (name,price) value('矿区水',5); Query OK, 1 row affected (0.05 sec) mysql> insert into t_product (name,price) value('口香糖',2); Query OK, 1 row affected (0.04 sec) mysql> insert into t_product (name,price) value('巧克力',9); Query OK, 1 row affected (0.05 sec)