当前位置:   article > 正文

python sqlite数据库画图_Python 操作SQLite数据库

python 模糊算选sqlite制作曲线

SQLite,是一款轻型的数据库,是遵守ACID的关系型数据库管理系统,它包含在一个相对小的C库中。在很多嵌入式产品中使用了它,它占用资源非常的低,python 中默认继承了操作此款数据库的引擎 sqlite3 说是引擎不如说就是数据库的封装版,开发自用小程序的使用使用它真的大赞

简单操作SQLite数据库:创建 sqlite数据库是一个轻量级的数据库服务器,该模块默认集成在python中,开发小应用很不错.

import sqlite3

# 数据表的创建

conn = sqlite3.connect("data.db")

cursor = conn.cursor()

create = "create table persion(" \

"id int auto_increment primary key," \

"name char(20) not null," \

"age int not null," \

"msg text default null" \

")"

cursor.execute(create) # 执行创建表操作

简单操作SQLite数据库:简单的插入语句的使用

insert = "insert into persion(id,name,age,msg) values(1,'lyshark',1,'hello lyshark');"

cursor.execute(insert)

insert = "insert into persion(id,name,age,msg) values(2,'guest',2,'hello guest');"

cursor.execute(insert)

insert = "insert into persion(id,name,age,msg) values(3,'admin',3,'hello admin');"

cursor.execute(insert)

insert = "insert into persion(id,name,age,msg) values(4,'wang',4,'hello wang');"

cursor.execute(insert)

insert = "insert into persion(id,name,age,msg) values(5,'sqlite',5,'hello sql');"

cursor.exe

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/运维做开发/article/detail/891457
推荐阅读
相关标签
  

闽ICP备14008679号