SQLite常用命令

前端之家收集整理的这篇文章主要介绍了SQLite常用命令前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

创建数据库

关键词:create table

create table person (id integer primary key autoincrement,name varcher(64),address varchar(64))
创建名为person的数据库,列名为自动增长的id,char类型的name,char类型的address。



插入语句:

关键词:insert into

insert into person(id,name,address) values ('1','myu','beijing')

person数据表插入一条 id为1,name为myu,address为beijing 的数据。



更新语句:

关键词:update

update person set address='zhejiang' where id = 2

更新person数据表,修改id为2的数据中的address为zhejiang



查询语句:
关键词:select

select * from person where id =2
查询person数据表中id为2的所有数据 (*代表通配符,意思是所有数据。如果要查询name等,则替换*即可)



删除语句:

关键词:delete

delete from person where id = 2
删除person数据表中id为2的数据


添加一个新列:

关键词:alter table

alter table person add age int default 0
person数据表添加一列名为age 类型为int的表,赋予默认值为0

猜你在找的Sqlite相关文章