SQliteSQ语句整理及简介

来源:互联网 发布:eclipse端口号在哪改 编辑:程序博客网 时间:2024/06/08 09:14

1 什么事SQlite?

SQlite是小型的高效的无数据类型的(但是为了可读性我们会加上类型) 开源的程序驱动的数据库。


2 SQlite 支持的的数据类型。

Integer varchar[10] char [10] double float text

3 SQlite 常见的SQ语句。

首先是创建表

create table 表名(字段名称 数据类型 约束条件(是否是主键)。。。,(下一个新字段之前的字段需用逗号隔开))

例子

create table teacher( _id Integer  Primary Key,name varchar[10],age Integer Integer not null)


删除表 比较简单

drop table 表名

drop table tercher


插入表

insert into 表名(字段名,字段名) values(插入值,插入值)

insert into teacher(name,age)values("mrs",1)//此为根据字段的名字插入

insert into teacher(1,"ms",22)   //此为所有字段全部插入按照表的字段顺序


修改表

update table 表名 set  字段名=新值 where 条件

update table teacher set name=“ok”,age="26 where _id=1

查询表 模糊查询 条件查询

select 字段 from表名 where 条件 group by 分组的字段 having查询条件 order by 排序字段

说实话我要不是查询资料我都忘了红色的功能了,完全没怎么用过

介绍通配符*表示所有         =表示等于         <>表示不等于       >表示大于       <表示小于

select  * from teacher 表示查询所有

select name from teacher where _id=1

select  * from teacher where name is null 判断是否为null字段

select * from teacher where name like "%ok%”当然这个like也分前后不过这种是最常用的

我写的不是特别全只是自己突然想起来写了随笔希望能帮到大家

原创粉丝点击