Sqlite—查询语句(Select)
基本语法如下
sqlite> select * from tb_user;
sqlite> select userid,username from tb_user;
格式化的查询输出
sqlite> .header on
sqlite> .mode column
sqlite> select * from tb_user;
设置输出列的宽度
sqlite> .width 10, 20, 10
sqlite> select * from tb_user;
SQLite 的 ORDER BY 子句是用来基于一个或多个列按升序或降序顺序排列数据。
基本语法:SELECT column-list FROM table_name [WHERE condition] [ORDER BY column1, column2, .. columnN] [ASC | DESC];
sqlite> select * from tb_user order by name asc; -- 结果按 name 升序排序:
sqlite> select * from tb_user order by name desc; -- 结果按 name 降序排序:
sqlite> select * from tb_user order by name,age asc; -- 结果按 name 和 age升序排序:
SQLite 的 Distinct 关键字
基本语法:SELECT DISTINCT column1, column2,.....columnN FROM table_name WHERE [condition]
sqlite> select distinct name from tb_user;
sqlite> select distinct name,age from tb_user;
sqlite> select distinct name,age from tb_user where name="liu";
Sqlite—查询语句(Select)的更多相关文章
- 如何在SQL Server查询语句(Select)中检索存储过程(Store Procedure)的结果集?
如何在SQL Server查询语句(Select)中检索存储过程(Store Procedure)的结果集?(2006-12-14 09:25:36) 与这个问题具有相同性质的其他描述还包括:如何 ...
- 用mybatis将SQL查询语句”select * from user”的封装为配置文件
用mybatis将SQL查询语句”select * from user”的封装为配置文件 定义一个xml映射文件,文件名见名知意.如user-mapper.xml,文件内容如下: <?xml v ...
- 阿里面试题: (a,b,c)组合索引, 查询语句select...from...where a=.. and c=..走索引吗?
面试官:(a,b,c)组合索引,查询语句select...from...where a=.. and c=..走索引吗应聘者: 最佳左前缀法,如果索引了多列,要遵守最左前缀法则,否则索引失效 按最左前 ...
- MySQL查询语句(select)详解(2)
7.子查询 当进行查询的时候,需要的条件是另外一个select语句的结果,这时候就要用到子查询 用于子查询的主要关键字有:in,not in,=,!=,exists,not exists等. 以下两张 ...
- NumberFormatException: Invalid int类型不匹配异常——使用SQL数据库查询语句select * from blacknumber order by _id desc limit ?,20;出现
异常:类型不匹配 05-06 08:12:38.151: E/AndroidRuntime(14904): java.lang.NumberFormatException: Invalid int: ...
- SQL复杂查询语句-SELECT * FROM cs WHERE score>70 GROUP BY s_id HAVING COUNT(*)>1
如果同时存在where,group by,的时候的执行顺序应该是这样的: 1,首先where后面添加条件把数据进行了过滤,返回一个结果集 2,然后group by将上面返回的结果集进行分组,返回一个结 ...
- MySQL查询语句(select)详解(1)
1.查询记录 select*from 表名 [where 条件];eg:select*from students;//查询 students 表中所有记录,所有字段的值都显示出来select fiel ...
- php学习之sqlite查询语句之多条件查询
一.PHP+Mysql多条件-多值查询示例代码: index.html代码:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitio ...
- SQL 简单查询语句 select
select *from emp;//查询emp表内容
随机推荐
- JavaScript如何创建一个对象
我们可以利用JavaScript的语法特征,以类的思想来创建对象. 方法一:原始方法代码如下: <script> var obj = new Object(); obj.name = &q ...
- C# 轮流展示照片
代码 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; u ...
- spring boot 中@Mapper和@Repository的区别
0--前言 @Mapper和@Repository是常用的两个注解,两者都是用在dao上,两者功能差不多,容易混淆,有必要清楚其细微区别: 1--区别 @Repository需要在Spring中配置扫 ...
- Android Native Binder,在Native层与App交互数据
Binder底层是基于C实现的,因此可以作为Native进程与App层交互数据的渠道.其应用场景为:Native Service.Hal驱动设置.应用层JNI服务等. Android 4.4引入SEA ...
- Scrapy爬虫及案例剖析
由于互联网的极速发展,所有现在的信息处于大量堆积的状态,我们既要向外界获取大量数据,又要在大量数据中过滤无用的数据.针对我们有益的数据需要我们进行指定抓取,从而出现了现在的爬虫技术,通过爬虫技术我们可 ...
- WebGL简易教程——目录
目录 1. 绪论 2. 目录 3. 资源 1. 绪论 最近研究WebGL,看了<WebGL编程指南>这本书,结合自己的专业知识写的一系列教程.之前在看OpenGL/WebGL的时候总是感觉 ...
- 【开发记录】Linux常用命令记录(一)
记录CentOS下,常用的命令.有时候很难记得清楚,同时方便新来的同学查阅.(将不停的追加和完善) 1)查看CPU情况 cat /proc/cpuinfo |grep "model name ...
- cenos基本信息和ssh
一.查看cenos相关信息 1.查看cpu more /proc/cpuinfo grep "model name" grep "model name ...
- The file “XXX.app” couldn’t be opened because you don’t have permission to view it.问题修复
出现下列问题 怎么解决呢 如图 将info.plist的文件中的Executable.file中的文件修改为:$(PRODUCT_NAME) 重新编译 com+R不出意外的话 运行成功 ok 解决~
- git配置文件—— .editorconfig
参考文档 editorconfig官方文档 github/editorconfig/wiki文档 一 概述 editorConfig不是什么软件,而是一个名称为.editorconfig的自定义文件. ...