我正在尝试使用python和sqlite从我的数据库中删除用户。
import sqlite3
database_connection = sqlite3.connect('test.db')
delete_username_input = input("Which user you would like to delete?\n\n")
sql = ("DELETE * from USERS where USERNAME = ?")
args = (delete_username_input)
database_connection.execute(sql, args)
database_connection.commit()
database_connection.close()
运行上面的代码时,我收到以下错误:
sqlite3.OperationalError: near "*": syntax error
知道可能导致此错误的原因是什么?
我使用的表格是使用以下语法创建的:
conn.execute('''CREATE TABLE USERS
(ID INTEGER PRIMARY KEY AUTOINCREMENT,
USERNAME TEXT NOT NULL,
PASSWORD TEXT NOT NULL,
WINS FLOAT NOT NULL,
LOSES FLOAT NOT NULL,
GAMESPLAYED FLOAT NOT NULL,
WINPERCENT FLOAT NOT NULL );''')
任何帮助将不胜感激。