Android开发数据库Sqlite2

1.创建字段

DatabaseHelper.java

//创建字段
        String sql = "create table " +Constants.TABLE_NAME + "(_id integer,name varchar,age integer,salary integer)";
        db.execSQL(sql);

2.添加字段

//添加字段
        String sql = "alter table "+Constants.TABLE_NAME+" add phone integer";
        db.execSQL(sql);

猜你喜欢

转载自www.cnblogs.com/xrj-/p/12310081.html
今日推荐