常用的命令之 Sqlite
作者:互联网
// 创建数据表
create table if not exists Student (id integer primary key autoincrement, name text, age integer)
// 删除数据表
drop table if exists Student
// 添加数据
insert into Student (name, age) values ('张三', 20)
insert or replace into Student (name, age) values ('张三', 20)
replace into Student (name, age) values ('张三', 20)
// 更新数据
update Student set name = '李四', age = 15 where id = 1
// 删除数据
delete from Student where id = 1
delete from Student where name = '李四'
// 查询数据
select * from Student where id = 1
select * from Student where name = '李四' and age = '20'
select * from Student where name = '李四' or name = '张三'
select * from Student where name = '李四' order by asc // 升序
select * from Student where name = '李四' order by desc // 降序
select * from Student where age > 10 order by desc
select * from Student where age in (10, 20, 30) // 查询age 在某个里面的
select * from Student where age between 10 and 20 // 查询年龄在10 到 20 的
标签:Sqlite,20,name,age,常用,命令,Student,where,select 来源: https://www.cnblogs.com/dulinshun/p/chang-yong-de-ming-ling-zhi-sqlite.html