增[1]insert into info values(null,'张三',18,'男') 查[2]select * from info; 改[3]update info set age='20' where name='张三' 删[4]delete from info where name='张三'
[1]create table info(_id integer primary key autoincrement,name text,money text) [2]insert into info values(null,'张三',5000) [2]insert into info values(null,'李四',5000)
事务的标准写法: db.beginTransaction(); try { ... db.setTransactionSuccessful(); } finally { db.endTransaction(); } 业务逻辑: [1]update info set money = money-200 where name='张三' [2]update info set money = money+200 where name='李四' 事务没有执行成功 就会执行回滚操作,实际上就是撤消之前的操作