我正在尝试将新信息插入到已经存在的表中。这是我的代码不起作用:
INSERT INTO customer (cNo, cName, street, city, county, discount)
VALUES (10, Tom, Long Street, Short city, Wide County, 2);
我哪里错了?
您必须对字符串值使用引号:
INSERT INTO customer (cNo, cName, street, city, county, discount)
VALUES (10, 'Tom', 'Long Street', 'Short city', 'Wide County', 2);
您没有正确指定您的字符串,它应该是:
INSERT INTO customer (cNo, cName, street, city, county, discount)
VALUES (10, 'Tom', 'Long Street', 'Short city', 'Wide County', 2);
您必须用逗号分隔值,并用引号 (' ') 将文本字段括起来。检查这个
试试这个代码:
INSERT INTO customer (cNo, cName, street, city, county, discount)
VALUES (10, 'Tom', 'Long Street', 'Short city', 'Wide County', 2);