创建一张data表
create table Students(id,name,score);
创建一张data表,如果不存在,就创建,如果存在,就不创建
create table if not exists Students(id,score);
查看数据库有几张表
.table
删除表
drop table
插入一条数据
insert into Students values(0,' 令狐冲',90);
第二种添加数据的方式
insert into Students(id,score)values(2,'张无忌',90);
显示当前路径
.databases
修改数据
update Student set name = '东方不败' where id = 2;
删除一条数据
delete from Students where id = 3;
查询前三条数据
select * from Students limit 3;
select name from Students;
select name,score from Students;
顺序排序
select * from Students order by score;
逆序排序
select * from Students order by score desc;
最前面的三名
select * from Students order by score desc limit 3;
修改主键id的值
update GongFU set id = 1 where id = 2;
建立两表之间的查询
select Students.id,Students.name,Students.score,GongFU.name from Students,GongFU where Students.id = GongFU.id;
查找某个表中有多少个元素
select * count(*)from Students;
原文链接:https://www.f2er.com/sqlite/201210.html