查询语句:select * from 表名 where 条件子句 group by 分组字句 having … order by 排序子句
如:
select * from person
select * from person order by id desc
select name from person group by name having count(*)>1
分页sql与MysqL类似,下面sql语句获取5条记录,跳过前面3条记录
select * from Account limit 5 offset 3 或者 select * from Account limit 3,5
插入语句:insert into 表名(字段列表) values(值列表)。如: insert into person(name,age) values(‘名称’,3)
更新语句:update 表名 set 字段名=值 where 条件子句。如:update person set name=‘名称‘ where id=10
删除语句:delete from 表名 where 条件子句。如:delete from person where id=10
查询语句:select * from 表名 where 条件子句 group by 分组字句 having ... order by 排序子句 如: select * from person select * from person order by id desc select name from person group by name having count(*)>1 分页sql与MysqL类似,下面sql语句获取5条记录,跳过前面3条记录 select * from Account limit 5 offset 3 或者 select * from Account limit 3,5 插入语句:insert into 表名(字段列表) values(值列表)。如: insert into person(name,age) values(‘名称’,3) 更新语句:update 表名 set 字段名=值 where 条件子句。如:update person set name=‘名称‘ where id=10 删除语句:delete from 表名 where 条件子句。如:delete from person where id=10
补充adding:
1.查询:
法1:Cursor c = db.rawQuery(“select * from user where username=? and password = ?”,
new Stirng[]{“用户名”,”密码”});
法2:db.query(“表名”,new String[]{“字段1,字段2”},“条件1=? and 条件2=?”,new String[]{“条件1的值,条件2的值”},null,null)
法3:db.rawQuery(“select * from 表名 orderby KEY_ENDTIME”,null);来写,升序降序
KEY_ENDTIME ASC 升序
KEY_ENDTIME DESC 降序
必看的资源:关于增删改查的详细讲解文章: