表的创建
db.execSQL("create table info(_id integer primary key autoincrement,name varchar(20)");

db.execSQL("alter table info add phone varchar(20)");


增删改查sql语句

--insert into info(name,phone) values('王五','13777777');
--delete from info where name='王五';
--update info set phone='139999999'where name='王五';
--select name,phone from info


------------------------------
数据库事务
    db.execSQL("create table info (_id integer primary key autoincrement,name varchar(20),phone varchar(20),money varchar(20))");
        db.execSQL("insert into info ('name','phone','money') values ('张三','138888','2000')");
        db.execSQL("insert into info ('name','phone','money') values ('李四','139999','5000')");





db.execSQL("update info set money= money-200 where name=?",new String[]{"AA"});
//                    int i = 100/0;
                    db.execSQL("update info set money= money+200 where name=?",new String[]{"BB"});




相关文章:

  • 2022-12-23
  • 2022-01-07
  • 2021-10-12
  • 2021-06-07
  • 2022-12-23
  • 2021-11-12
  • 2021-07-28
猜你喜欢
  • 2021-12-04
  • 2021-12-04
  • 2022-12-23
  • 2021-10-27
  • 2022-12-23
  • 2021-11-19
  • 2021-08-06
相关资源
相似解决方案