繁体   English   中英

您的 SQL 语法有错误; 检查与您的 MySQL 服务器版本相对应的手册,以获取在 ') 附近使用的正确语法

[英]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 ')

from bs4 import BeautifulSoup
import requests
import mysql.connector

my_db = mysql.connector.connect(
    host = "localhost",
    user = "root",
    password = "mypassword",
    database =  "findingimdbscore",
)
my_cursor = my_db.cursor()

my_cursor.execute("CREATE TABLE IF NOT EXISTS film_ve_puan (film_name VARCHAR(100),ImbdScore DOUBLE(4),film_id INTEGER AUTO_INCREMENT PRIMARY KEY)")

所有变量的颜色都改变了,但 film_id 没有改变顺便说一句

DOUBLE(4)不是合法的 MySQL 类型。 您可以使用FLOAT(4)或只是DOUBLE

CREATE TABLE film_ve_puan (
  film_name VARCHAR(100),
  ImbdScore DOUBLE,
  film_id INTEGER AUTO_INCREMENT PRIMARY KEY
)

https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html

我认为您应该将 DOUBLE(4) 更改为仅 DOUBLE

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM