簡體   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