ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

常用的命令之 Sqlite

2022-07-07 14:00:24  阅读:162  来源: 互联网

标签:Sqlite 20 name age 常用 命令 Student where select


// 创建数据表
create table if not exists Student (id integer primary key autoincrement, name text, age integer)

// 删除数据表
drop table if exists Student

// 添加数据
insert into Student (name, age) values ('张三', 20)
insert or replace into Student (name, age) values ('张三', 20)
replace into Student (name, age) values ('张三', 20)

// 更新数据
update Student set name = '李四', age = 15 where id = 1

// 删除数据
delete from Student where id = 1
delete from Student where name = '李四'

// 查询数据
select * from Student where id = 1
select * from Student where name = '李四' and age = '20'
select * from Student where name = '李四' or name = '张三'
select * from Student where name = '李四' order by asc    // 升序
select * from Student where name = '李四' order by desc   // 降序
select * from Student where age > 10 order by desc
select * from Student where age in (10, 20, 30)         // 查询age 在某个里面的
select * from Student where age between 10 and 20       // 查询年龄在10 到 20 的

标签:Sqlite,20,name,age,常用,命令,Student,where,select
来源: https://www.cnblogs.com/dulinshun/p/chang-yong-de-ming-ling-zhi-sqlite.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有