zoukankan      html  css  js  c++  java
  • android 数据库_sql语句总结


    表的创建
    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"});




  • 相关阅读:
    1月28日 layout_list_item
    1月27日 listview_MyListAdapter
    1月26日 listviewxml
    1月25日 textview
    1月24日 人月神话3
    体温填报(三)
    体温填报(二)
    体温填报(一)
    家庭记账本(六)
    家庭记账本(五)
  • 原文地址:https://www.cnblogs.com/liangqiyuan/p/5690511.html
Copyright © 2011-2022 走看看