litepal查询和删除数据

 
  
查询数据
//查找id100的数据
Student student = DataSupport.find(Student.class, 100);
//查找id1,2,3,4,5的数据
List students1 = DataSupport.findAll(Student.class, 1, 2,3, 4, 5);
//查找age>23的学生的数据
List students = DataSupport.where("age=?", "age>23").find(Student.class);



删除数据
//删除id1的数据
int delete = DataSupport.delete(Student.class, 1);
//删除年龄为12的数据
    DataSupport.deleteAll(Student.class,"age=?","12");
//删除年龄为12名字是花花的数据
DataSupport.deleteAll(Student.class,"name=?and age=?","花花","12");
 
 

你可能感兴趣的:(数据库相关)