我有一个表ttt,其中有一列名为:second (test)。抛出语法错误:Syntax Error因为单词之前的括号test。
编写 SQL 查询以向该列添加数据的正确方法是什么?
INSERT INTO ttt(first, second (test)) VALUES('{}', '{}')".format(...)
错误:
mysql.connector.errors.ProgrammingError: 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 '(test)) VALUES(... at line 1
桌子:

试试这样:
注意:如果您有一点机会重命名列,使其名称仅包含英文字母和下划线 - 我强烈建议使用它!这将有助于避免许多潜在的问题......