包含名为“order”的列的查询出现查询错误
对于我的一生,我似乎能弄清楚
INSERT INTO category SET CategoryName = 'Hardware_1',
Category = 'HARDWARE', Status = '1', Order = '1'
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 'Order = '1'' at line 1
CREATE TABLE `category` (
`CategoryID` int(11) NOT NULL AUTO_INCREMENT,
`CategoryName` varchar(255) NOT NULL,
`Category` varchar(255) NOT NULL,
`Status` tinyint(4) NOT NULL,
`Order` int(11) NOT NULL,
PRIMARY KEY (`CategoryID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
For the life of me i can seem to figure it out
INSERT INTO category SET CategoryName = 'Hardware_1',
Category = 'HARDWARE', Status = '1', Order = '1'
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 'Order = '1'' at line 1
CREATE TABLE `category` (
`CategoryID` int(11) NOT NULL AUTO_INCREMENT,
`CategoryName` varchar(255) NOT NULL,
`Category` varchar(255) NOT NULL,
`Status` tinyint(4) NOT NULL,
`Order` int(11) NOT NULL,
PRIMARY KEY (`CategoryID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Order
是保留字。如果您打算使用 Order,请用反引号将其括起来。Order
is a reserved word. Enclose Order in backticks if you intend to use it.正如 Cfreak 在评论中指出的那样,您的语法是有效的。问题在于您对未转义的 Order 关键字的使用。
As Cfreak pointed out in the comments, your syntax is valid. It's your use of the unescaped Order keyword that is the issue.
order 是 sql 中的保留字,您可能需要转义该列名:
order is a reserved word in sql, you proably need to escape that column name: