MYSQL error: A new statement was found but no delimiter between it and the previous one

MYSQL error: A new statement was found but no delimiter between it and the previous one

我正在尝试用这个简单的查询来更新我的专栏:

 UPDATE products SET desc='1' WHERE  1

但我收到此错误消息:找到了一个新语句,但它与前一个语句之间没有分隔符。如果我将 desc 列更改为另一列而不是查询正常工作。

我看到 这是一个错误,我将我的 phpmyadmin 更新到最新版本 5.1,但我仍然收到此错误消息,可能是什么问题?

DESC 是 reserved word in MySQL 用于对查询结果进行排序。

Keywords are words that have significance in SQL. Certain keywords, such as SELECT, DELETE, or BIGINT, are reserved and require special treatment for use as identifiers such as table and column names. This may also be true for the names of built-in functions.

Nonreserved keywords are permitted as identifiers without quoting. Reserved words are permitted as identifiers if you quote them as described in Section 9.2, “Schema Object Names:

正如我在上面强调的那样,如果你想将它用作标识符,你可以引用一个保留字,使用

The identifier quote character is the backtick (`)

因此您只需稍微更改查询并添加反引号即可。

UPDATE products SET `desc`='1' WHERE  1;

你可以看一个小例子here