ios开发之数据库FMDB

选择以下按钮进行编辑

 

数据库的创建

create table if not exists StudentInfo(sid integer,username vachar(20),password vachar(20),scare vachar(20))

插入

insert into StudentInfo(sid,username,password,score)

values(1501,'zhangsan','123','100’)

查询

select "from StudentInfo”;

查询指定字段

select username from StudentInfo;

查询指定条件的信息

select *from StudentInfo where username=‘zhangsan’

根据指定多个条件查询

select *from StudentInfo where username='zhangsan' and password=‘123'

默认升序排序

select *from StudentInfo order by score

降序排序

select *from StudentInfo order by score desc

统计行数

select count(*)from StudentInfo

修改数据

update StudentInfo set score='100' where username='zhangsan’;

删除数据

delete from StudentInfo where sid='1502'

原文地址:https://www.cnblogs.com/xjia/p/4389609.html