不能使用列名"desc"在MySQL中 [英] Can't use column name "desc" in mysql
本文介绍了不能使用列名"desc"在MySQL中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
INSERT INTO movie (id, title, desc, released, views, featured) VALUES ('', 'title', '
\r\n description
\r\n', '2006-12-12', '0', '0')
错误是
1064-您的SQL语法有错误;检查与您的MySQL服务器版本相对应的手册以使用正确的语法 靠近描述,发布,视图,精选)VALUES(,"标题", \ r \ n说明\ r \ n','位于第1行
1064 - 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 'desc, released, views, featured) VALUES ('', 'title', ' \r\n description \r\n', ' at line 1
表结构为
id [ (pk, auto_inc) int(11) ]
title [ varchar(256) ]
desc [ text ]
released [ date ]
views [ int(11) ]
featured [ int(11) ]
在phpmyadmin sql编辑器中运行
running in phpmyadmin sql editor
推荐答案
desc是 mysql保留字.您必须在带有保留字的列中使用反引号''.
desc is a mysql reserved word. you must use backticks `` with the columns which are reserved words.
INSERT INTO movie (id, title, `desc`, released, views, featured)...
您应避免使用保留字作为列名或必须使用反引号(``)
You should avoid using reserved words as column name or must use backticks (``)
这篇关于不能使用列名"desc"在MySQL中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文