这个插入语句有什么问题?我看了好几遍了,也没看出哪里不对。
INSERT INTO tasks
(task_id, priority, limit, total_active, time_limit, start_time, params)
VALUES ("d", "9", "1", "0", "1549699912", "1549696366", "");
+--------------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| task_id | varchar(2) | NO | | NULL | |
| priority | tinyint(1) | NO | | 0 | |
| limit | int(11) | NO | | NULL | |
| total_active | int(11) | NO | | NULL | |
| time_limit | int(11) | NO | | NULL | |
| start_time | int(11) | NO | | NULL | |
| params | tinytext | YES | | NULL | |
+--------------+------------+------+-----+---------+----------------+
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 '
limit, total_active, time_limit, start_time, params) VALUES ("1", "d", "9", "1",
' at line 1
最佳答案
LIMIT
是sql中的关键字,需要在其周围添加双引号。
INSERT INTO tasks(task_id, priority, "limit", total_active, time_limit,
start_time, params) VALUES ("d", "9", "1", "0", "1549699912", "1549696366", "");
编辑:如果这不起作用,您可以使用反引号进行转义:
INSERT INTO tasks(task_id, priority, `limit`, total_active, time_limit,
start_time, params) VALUES ("d", "9", "1", "0", "1549699912", "1549696366", "");
关于mysql - 损坏的插入语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54604198/