Android开发实战总结

Android SQLite数据库操作

2017-10-25  本文已影响101人  AKyS佐毅

1. Sqlite简介

2. Sqlite的使用场景

3. 数据库的创建

数据库的创建

4:Sqlite数据库中获取数据库对象的两个方法:

5. Sqlite数据库中简单的Sql语句:

delete from person where name = 'wuyun'

6: 使用API 的增删改查操作

Android提供了一个名为SQLiteDatabase的类,该类封装了一些操作数据库的API,使用该类可以完成对数据进行添加(Create)、查询(Retrieve)、更新(Update)和删除(Delete)操作(这些操作简称为CRUD)。

定义
db.insert(String table ,String nullColumnHack,ContentValues values);
db.update(String table ,ContentValues values,String whereClause, String whereArgs);
db.delete(String table,String whereClause,String whereArgs);
db.rawQuery(String sql, String[] selectionArgs);  

db.query(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy);  

db.query(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit);  

db.query(String distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit);  
上一篇下一篇

猜你喜欢

热点阅读