我尝试使用 vscode 和 mysql 在 postman 上发帖
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'release, genre, console, price, summary, video_link, image_link, image2_link, de' at line 1
我在 vscode 中使用了什么
INSERT INTO games (Category_id, title, release, genre, console, price,
summary, video_link, image_link, image2_link, developer, category)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?);
我在postman中用到的
{
"Category_id": "3",
"title": "Monster Hunter World",
"release": "2018",
"genre": "Actiom",
"console": "PS4",
"price": 69,
"summary": "hunting",
"video_link": "youtube.com",
"image_link": "image1",
"image2_link": "image2",
"developer": "Capcom",
"category": "new"
}
最佳答案
release
是 reserved word in MySQL .如果您打算将它作为列名,则需要对其进行转义:
INSERT INTO games (Category_id,
title,
`release`, -- Here, using the `s
genre,
console,
price,
summary,
video_link,
image_link,
image2_link,
developer,
category)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?);
关于python - 您的 SQL 语法有误;检查与您的 MariaDB 服务器版本对应的手册,了解在第 1 行附近使用的正确语法”,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54044351/