創(chuàng)建表: create table if not exists 表名 (字段名1, 字段名2...);
create table if not exists t_student (id integer primary key autoincrement, name text not null, age integer)
增加數(shù)據(jù): insert into 表名 (字段名1, 字段名2, ...) values(字段1的值, 字段2的值, ...);
insert into t_student (name,age) values (@"Jack",@17);
根據(jù)條件刪除數(shù)據(jù): delete from 表名 where 條件;
delete from t_student where name = @"Jack";
刪除表中所有的數(shù)據(jù): delete from 表名
delete from t_student
根據(jù)條件更改某個數(shù)據(jù): update 表名 set 字段1 = '值1', 字段2 = '值2' where 字段1 = '字段1的當(dāng)前值'
update t_student set name = 'lily', age = '16' where name = 'Jack'
根據(jù)條件查找: select * from 表名 where 字段1 = '字段1的值'
select * from t_student where age = '16'
查找所有數(shù)據(jù): select * from 表名
select * from t_student
刪除表: drop table 表名
drop table t_student
排序查找: select * from 表名 order by 字段
select from t_student order by age asc (升序,默認(rèn)) select from t_student order by age desc (降序)
限制: select * from 表名 limit 值1, 值2
select * from t_student limit 5, 10 (跳過5個,一共取10個數(shù)據(jù))