首页 > IT职业 > IT生活 > SQL的数据库操作:添加、更新、删除、查询
添加数据库的方法:
db.execSQL("insert into Book (name,author,pages,price) values(?,?,?,?)",new String[]{"Jane Success","Jane Zhong","555","165"});
更新数据的方法:
db.execSQL("update Book set price=? where name=?",new String[]{"10.9","La la land"});
删除数据的方法:
db.execSQL("delete from Book where pages > ?",new String[]{"500"});
查询数据的方法:
db.rawQuery("select * from Book",null);
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2157/viewspace-2826408/ ,如需转载,请注明出处,否则将追究法律责任。