SQLite常用操作:


创建表格:

create table staff(


_id integer primary key autoincrement,

name text,

sex text,

department text,

salary float


 )

增加数据:

insert into staff values(null,'Jim','male','computer','5400');

删除数据

delete from staff where name="Jim";

更改数据

update staff set name='Jim' where name="Tom";

查询数据

public People[] select(){
		  //String table="DB_TABLE";
		  String[] columns = new String[] { KEY_ID,KEY_NUM, KEY_NAME, KEY_ADDRESS, KEY_SPECIALTY};
		  String selection = "_id>?"+"and Address=?";  //多重条件选择,需要加and
		  String[] selectionArgs = new String[]{"12","北京"};  //对应 ? 的值
		  String groupBy = null;  
		  String having = null;  
		  String orderBy = null;   		  
		Cursor results =  db.query(DB_TABLE, columns, selection, selectionArgs, groupBy, having, orderBy, null);
		return ConvertToPeople(results);
	  }