sqlite是比较轻量级数据库
类型:关系型数据库
安装的时候:
1.dll类型文件
2.tools工具文件
一起解压到同一个文件夹下sqlite
通过命令行代码来使用sqlite3.exe
Linux系统自带
我们通过sqlite3这个工具使用数据库
操作的书写格式:
sqlite3 mrq.db表示创建一个数据库文件名称为mrq.db
.tables表示显示当前数据库中所有的表有哪些
create table userinfo(username,password);:表示创建userinfo数据表
insert into userinfo(username,password) values('mrq',123);:向数据表userinfo中插入一行记录mrq|123
select*from userinfo;:表示查询userinfo表中的所有数据
更新数据库中所有的数据记录用update
更新所有行的password字段的值使用update userinfo set password=12322;
更新某一行指定的记录对应的password,此时需要用where语句进行筛选定位
update userinfo set password=123 where username='mrq';
如果想要清空某张表,使用delete语句
delete from userinfo; 清空userinfo表中的所有的记录
想要清除指定行的记录,就要结合where语句
重要提醒:数据库操作之前最好备份;