假设我的表名 Company 有两列 cname, location。
在表中,我有两条记录
cname |位置
Asmetric |达拉斯
Sophore |华盛顿
当我执行删除操作时在这张表上
delete company where cname='Sophore';
Run Code Online (Sandbox Code Playgroud)
我收到一个错误
Error 1064:You have an error in sql syntax check the manual that corresponds to your sql server version
而我原以为完整的记录会被删除,是语法错误还是不完整。欢迎提出任何建议
你的错误输出很奇怪,应该是:
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 'where cname='Sophore'' at line 1
Run Code Online (Sandbox Code Playgroud)
这会告诉您错误的确切位置 - 您忘记了FROM
DELETE 子句:
DELETE FROM company WHERE cname='Sophore';
Run Code Online (Sandbox Code Playgroud)