python - 您的 SQL 语法有误;检查与您的 MariaDB 服务器版本对应的手册,了解在第 1 行附近使用的正确语法”,

标签 python mysql visual-studio-code syntax-error postman

我尝试使用 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"
}

最佳答案

releasereserved 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/

相关文章:

macos - Visual Studio Cloud Explorer 的 OS X 替代方案

python - 用 str.replace() 替换数字

python - 如何处理Python正则表达式匹配中的多行模式

php - 如何在文件系统中存储私有(private)用户图像而不妨碍他们的隐私?

MySQL子查询问题

visual-studio-code - 在 Visual Studio Code 中键入表达式时出现重复提示

gulp - 在 VSCode 中创建文件观察器

Python 通过其属性子集或单个属性删除重复对象

python - 屏幕抓取:处理 POST 登录

php - 如何更新记录 'pay' laravel?