sqlite3 是SQLite的python接口,由Gerhard Häring编写,属于python的标准库,无需额外安装。下面介绍sqlite3的用法。...更多的SQL的 语法请参考下面的链接:https://www.runoob.com/sqlite/sqlite-syntax.html
向表中增加数据:
# 增加一行数据
c.execute("INSERT...male', 30],
[9,'熊大', 'bear', 'male', 300],
[10,'熊二', 'bear', 'male', 280]]
# 增加多行数据...", ( "male", )) #求数量
n =c.fetchone()[0]; print("count: ", n)
c.execute("select AVG(weight) from pets...", ( "male", )) #求最大值,自动忽略空值
print("Max: ", c.fetchone()[0])
c.execute("select Min(weight) from pets