0

我正在尝试将新信息插入到已经存在的表中。这是我的代码不起作用:

INSERT INTO customer (cNo, cName, street, city, county, discount)
VALUES (10, Tom, Long Street, Short city, Wide County, 2);

我哪里错了?

4

3 回答 3

4

您必须对字符串值使用引号:

INSERT INTO customer (cNo, cName, street, city, county, discount)
VALUES (10, 'Tom', 'Long Street', 'Short city', 'Wide County', 2);
于 2013-11-06T13:53:23.577 回答
3

您没有正确指定您的字符串,它应该是:

INSERT INTO customer (cNo, cName, street, city, county, discount) 
VALUES (10, 'Tom', 'Long Street', 'Short city', 'Wide County', 2);
于 2013-11-06T13:52:12.317 回答
2

您必须用逗号分隔值,并用引号 (' ') 将文本字段括起来。检查这个

试试这个代码:

INSERT INTO customer (cNo, cName, street, city, county, discount) 
VALUES (10, 'Tom', 'Long Street', 'Short city', 'Wide County', 2);
于 2013-11-06T13:55:03.483 回答