2024-03-29 10:22:07 发布
网友
import sqlite3 con = sqlite3.connect("Demo.db") cursor = con.cursor() query = "UPDATE Table set demoName = %s Where demoId = %s" cursor.execute(query,("demoName",1) con.commit()
这种方法行不通。 我想保留当前值并添加更多值这些价值观。我可以用什么代码来做。更新在这里不起作用
UPDATEsql命令用于更新现有行。使用INSERTsql命令创建新行
UPDATE
INSERT
import sqlite3 con = sqlite3.connect("Demo.db") cursor = con.cursor() query = "INSERT INTO Table (demoName, demoId) VALUES (%s, %s)" cursor.execute(query,("demoName",1) con.commit()
Python官方sqlite3文档提供了以下学习sql的链接:
https://www.w3schools.com/sql/ - Tutorial, reference and examples for learning SQL syntax.https://www.sqlite.org - The SQLite web page; the documentation describes the syntax and the available data types for the supported SQL dialect.
UPDATE
sql命令用于更新现有行。使用INSERT
sql命令创建新行Python官方sqlite3文档提供了以下学习sql的链接:
相关问题 更多 >
编程相关推荐