gpt4 book ai didi

mysql - 错误 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

转载 作者:IT老高 更新时间:2023-10-29 00:11:37 27 4
gpt4 key购买 nike

当我尝试向表中插入一行时,我收到以下错误:

ERROR 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 ''filename')
VALUES ('san', 'ss', 1, 1, 1, 1, 2, 1, 1, 'sment', 'notes','sant' at line 1

请帮帮我。

mysql> desc risks;
+-----------------+--------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+--------------+------+-----+---------------------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| status | varchar(20) | NO | | NULL | |
| subject | varchar(100) | NO | | NULL | |
| reference_id | varchar(20) | NO | | | |
| location | int(11) | NO | | NULL | |
| category | int(11) | NO | | NULL | |
| team | int(11) | NO | | NULL | |
| technology | int(11) | NO | | NULL | |
| owner | int(11) | NO | | NULL | |
| manager | int(11) | NO | | NULL | |
| assessment | longtext | NO | | NULL | |
| notes | longtext | NO | | NULL | |
| submission_date | timestamp | NO | | CURRENT_TIMESTAMP | |
| last_update | timestamp | NO | | 0000-00-00 00:00:00 | |
| review_date | timestamp | NO | | 0000-00-00 00:00:00 | |
| mitigation_id | int(11) | NO | | NULL | |
| mgmt_review | int(11) | NO | | NULL | |
| project_id | int(11) | NO | | 0 | |
| close_id | int(11) | NO | | NULL | |
| submitted_by | int(11) | NO | | 1 | |
| filename | varchar(30) | NO | | NULL | |
+-----------------+--------------+------+-----+---------------------+----------------+
21 rows in set (0.00 sec)

**mysql> INSERT INTO risks (`status`, `subject`, `reference_id`, `location`, `category`,
`team`, `technology`, `owner`, `manager`, `assessment`, `notes`,'filename') VALUES
('san', 'ss', 1, 1, 1, 1, 2, 1, 1, 'sment', 'notes','santu');**

ERROR 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 ''filename')
VALUES ('san', 'ss', 1, 1, 1, 1, 2, 1, 1, 'sment', 'notes','sant' at line 1

最佳答案

MySQL 中有两种不同类型的引号。您需要使用 ` 作为列名,使用 ' 作为字符串。由于您使用 ' 作为文件名列,因此查询解析器感到困惑。删除所有列名周围的引号,或将“文件名”更改为“文件名”。那么它应该可以工作了。

关于mysql - 错误 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,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22009582/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com