MySQL语法错误"在'desc附近使用正确的语法"

xan*_*ood -2 mysql sql mysql-error-1064

我正在使用Python并使用MySQLdb模块.我有一个工作连接(我可以成功运行其他查询)

c.execute("ALTER TABLE results ADD COLUMN desc TEXT")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.7/MySQLdb/cursors.py", line 166, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/pymodules/python2.7/MySQLdb/connections.py", line 35,
    in defaulterrorhandler
    raise errorclass, errorvalue
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

_mysql_exceptions.ProgrammingError: (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 TEXT' at line 1")
Run Code Online (Sandbox Code Playgroud)

我之前遇到过类似的麻烦; MySQLdb的语法错误消息非常不具描述性.

怎么解决这个问题?

Ada*_*ger 5

我相信desc是保留的.它用在一个ORDER BY条款中

如果你在它周围放置一些标记,你可能可以使用它,但我认为你最好将名称改为非保留字.