我试图在 sqlite 中创建一个表,在编写了我认为是正确的语法之后,我得到了一个错误回复。希望你不介意帮帮我

问题描述 投票:0回答:0

我尝试使用以下代码行在 sqlite3 中创建数据库表

import sqlite3
con = sqlite3.connection(":memory:")
conn = sqlite3.connect("customer.db")

#before you create a table, create your cursor. a cursor is what tells your database what you want to do

c = conn.cursor()

c.execute("""CREATE TABLE Customers (
       first_name text, 
       last_name text, 
       email text,)""")


conn.commit()

conn.close

当我运行代码时,使用 cmd 时出现操作错误,使用 Powershell 时出现语法错误。

我期待代码在 sqlite 中创建一个表。

sqlite sqliteopenhelper
© www.soinside.com 2019 - 2024. All rights reserved.