标签:htm work linux sort book close acid database 简介
SQLite,是一款轻型的数据库,它包含在一个相对小的C库,设计目标是嵌入式的,占用资源非常的低,嵌入式系统可能几百k就够,
处理速度比mysql,postgresql都快,是一个磁盘上的文件,比如linux系统某个某录下有个test.db
参考:https://baike.baidu.com/item/SQLite/375020?fr=aladdin
Python模块叫做PySQLite
# By Vamei
import sqlite3
# test.db is a file in the working directory.
conn = sqlite3.connect("test.db")
c = conn.cursor()
# create tables
c.execute('''CREATE TABLE category
(id int primary key, sort int, name text)''')
c.execute('''CREATE TABLE book
(id int primary key,
sort int,
name text,
price real,
category int,
FOREIGN KEY (category) REFERENCES category(id))''')
# save the changes
conn.commit()
# close the connection with the database
conn.close()
参考: https://www.cnblogs.com/work115/p/5948706.html
标签:htm work linux sort book close acid database 简介
原文地址:https://www.cnblogs.com/zhanghaibin16/p/12331783.html