目录
简介
源自bilibilihttps://www.bilibili.com/video/BV1t5411875k?t=4.0&p=1
SQLite 是一款轻型的数据库,遵守 ACID 的关系型数据库管理系统。它包含在一个相对小的 C 库中,设计目标是嵌入式的,已经在很多嵌入式产品中使用。SQLite 占用资源非常低,在嵌入式设备中可能只需要几百 K 的内存。它支持 Windows、Linux、Unix 等主流操作系统,并能与 Tcl、C#、PHP、Java 等程序语言结合,还有 ODBC 接口。相比 MySQL 和 PostgreSQL,SQLite 的处理速度更快。
基本操作
进入/退出 SQLite3
<!--进入sqlite3-->
sqlite3(命令行操作)[student](可选操作,即是否保存在文件中。如果保存,则可以根据路径来选着文件位置)
<!--退出sqlite3-->
.exit

创建表(int类型应改为integer。使用 INTEGER 更符合SQL标准规范,有助于提升代码的通用性和可移植性。)
<!--创建表-->
create table student (id integer, name text, age integer);
<!--查看表结构-->
.schema
<!--查看表-->
.table

插入数据
<!--插入数据-->
insert into student (id, name, age) values (1, "aa", 11);
insert into student values (2, "bb", 22), (3, 'cc', 33);

查询数据
<!--查询数据-->
select * from student;

修改/删除数据
<!--修改数据-->
update student set age = 18 where id = 3;
<!--删除数据-->
delete from student where id = 1;

删除表
<!--删除表-->
drop table student;

1381

被折叠的 条评论
为什么被折叠?



