加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

SQLite常用命令

发布时间:2020-12-12 19:45:50 所属栏目:百科 来源:网络整理
导读:创建数据库: 关键词:create table create table person (id integer primary key autoincrement,name varcher(64),address varchar(64)) 创建名为person的数据库,列名为自动增长的id,char类型的name,char类型的address。 插入语句: 关键词:insert into

创建数据库:

关键词: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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读