简体   繁体   中英

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)")

All of variables' color changed but film_id did'nt change btw

DOUBLE(4) isn't a legal MySQL type. You could use FLOAT(4) or just DOUBLE .

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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