目录
一:安装数据库
1.Linux下安装数据库
apt install sqlite3
2.Linux下使用数据库
sqlite3
3.Linux下退出使用数据库
.q
二:常用SQL语句的使用
创建并进入使用数据库
创建表
查看表
在表中插入数据
查看表中的数据信息
1.查看目录
ls
2.创建并进入使用数据库
sqlite3 my.db
3.创建表
create table student(id int,name text,pwd text);
4.查看表
.table
5.查看表(简写)
.ta
6.在创建的表中插入数据
insert into student(id,name,pwd) values (1001,"admin","123456");
7.查看表中的数据信息
select * from student;
8.退出数据库使用
.quit
三:SQL基础使用
进入使用数据库
在创建的表中插入数据
查看创建表中的数据
修改表中的某条数据
删除表中的某条数据
1.进入使用数据库
sqlite3 my.db
2.查看表
.ta
3.在创建的表中插入数据
insert into student(id,name,pwd) values (1002,"manager","123456");
4.查看创建表中的数据
select * from student;
5.查看表
.table
6.修改表中的某条数据
update student set pwd = "654321" where name = "admin";
7.查看表中数据(发现名字是admin的学生数据信息已被修改)
select * from student;
8.删除表中的某条数据
delete from student where id = 1001;
9.查看表中数据(发现id为1001的学生数据被删除)
select * from student;