1. Using basic 'order by'
# Order stu by stu_score as the order of descendant select * from stu order by stu_score desc;
2. Using 'order by' to order multiple columns
# Order table 'stu' by stu_score # If two row's stu_score are the same, then use stu_name as secondary order restriction select * from stu order by stu_score desc, stu_name desc;
3. Using 'order by' together with 'limit'
# Select the highest two stu_score select * from stu order by stu_score asc limit 2;
4. Limit [offset], [N]
offset: default 0;
N: The number of item to be selected.
<Limit is useful in paging>
Comment:
How can we fetch the stu_course for each student whose highest score belongs to this course?
Answer:
1. First, order the table stu as the stu_name as primary order regulator.
2. Second, set the stu_score as the secondary order regulator.
3. Last, regard the result set as a virtual table and the execute the query based on this table.
select * from (select * from stu order by stu_name asc, stu_score desc) as temp group by stu_name;
Summary:
1) where expression
To see if the expression is true on each row then fatch this row.
=, !=, <>, >, <, <=, >=
in, between and
or, and, not
2) group by
Is used for grouping, usually used together with statistic function.
sum, count, max, min, avg
3) having expression
If the expression is true when used in where clause, then it can be applied in having expression.
But if the expression is based on virtual table(or result set), then it can only applied in having expression. While expression can only applied for real table that stored on disk.
4) order by
Can be applied for order real table or result set as the order of [asc] or [desc].
Multiple compare rules are enabled.
5) limit
Can be applied for result set for paging or limit the shown item.
相关推荐
1 Scope and object This clause of the General Standard applies except ...Sub-clause 2.1.101, hereinafter referred to as EQUIPMENT. This standard does not apply to EQUIPMENT specified for hyperthermia.
关于xeus-sql 主页: : 软件包许可证:BSD-3-Clause 原料许可证: 简介:基于xeus和SOCISQL的Jupyter内核文档: : 当前构建状态蔚蓝 变体状态linux_64 osx_64 win_64当前发行信息姓名资料下载版本平台类安装xeus-sql...
软件包许可证:BSD-3-Clause 原料许可证: 简介:用于conda-forge生态系统的软件的基准版本 当前构建状态 所有平台: 当前发行信息 姓名 资料下载 版本 平台类 安装conda-forge-pinning 从conda-forge频道安装...
关于咖啡主页: : 软件包许可证:BSD-3-Clause 原料许可证: 简介:使用列式操作进行Collider HEP样式分析的工具当前构建状态所有平台:当前发行信息姓名资料下载版本平台类安装咖啡通过使用以下方法将conda-forge...
软件包许可证:BSD-3-Clause 原料许可证: 摘要:处理ASDF文件的Python工具 开发: : 文档: : 用于读取和写入ASDF文件的Python库。 高级科学数据格式(ASDF)是科学数据的下一代交换格式。 当前构建状态 ...
Intrinsic Safety Standards Analysis
1000BASE-X-AN-Clause37-V1.0.doc
1000BASE-X-PCS-Clause36-V1.0.doc
关于鲁宾环境主页: : 软件包许可证:BSD-3-Clause 原料许可证: 简介:用于安装Rubin Observatory通用软件环境的元软件包。 此元数据包用于定义Rubin Observatory通用软件环境,包括所需的版本规范,同时允许用户在...
关于petsc4py 主页: : 软件包许可证:BSD-2-Clause 原料许可证: 摘要:PETSc的Python绑定当前构建状态特拉维斯 无人机 蔚蓝 变体地位linux_64_mpimpichnumpy1.17python3.6 .____ cpython linux_64_mpimpichnumpy...
软件包许可证:BSD-2-clause 原料许可证: 简介:提供用于缓存R对象的直观功能,鼓励可重复,可重新启动和分布式R分析。 用户选择一个位置来存储高速缓存,然后只提供高速缓存名称和有关如何生成R对象的指令(R...
关于python-javabridge 主页: : 软件包许可证:BSD-3-Clause 原料许可证: 摘要:Java本机接口的Python包装器当前构建状态蔚蓝 变体状态linux_64_python3.6 .____ 73_pypy linux_64_python3.6 .____ cpython linux_...
关于异步广告主页: : 软件包许可证:LicenseRef-BSD-3-Clause-SLAC 原料许可证: 简介:纯Python中的Sans-I / O和asyncio TwinCAT3 ADS测试服务器。 开发: : 文档: : 当前构建状态所有平台:当前发行信息姓名...
clause1; clause2; ....; clauseN -default line,在defaults列表中增加一个缺陷:d:prerequisite:justification/consequent --先决条件的形式为子句1;子句2; ...;子句N --证明形式为子句1;子句2; ...;子句N --结果...
jslicense-bsd-2-clause 格式的两条款(“简化”)BSD 许可证
来源: 文件: 你不能骗我。 没有安全条款! -奇科·马克思健全条款是一个数据验证/合同库。 您可以将其用于配置数据,验证api响应或数据存储区中的文档。 使用动态类型的语言,它可以帮助您定义明确定义的疑问和不...
软件包许可证:BSD-3-Clause 原料许可证: 简介:与NSLS-II各种数据源的统一接口。 开发: : 文档: : 与NSLS-II上各种数据源的统一接口。 当前构建状态 所有平台: 当前发行信息 姓名 资料下载 版本 平台...
关于djangorestframework-xml 主页: : 软件包许可证:BSD-3-Clause 原料许可证:BSD 3-条款摘要:对Django REST Framework的XML支持当前构建状态所有平台:当前发行信息姓名资料下载版本平台类安装...
关于djangorestframework-yaml 主页: : 软件包许可证:BSD-3-Clause 原料许可证:BSD 3-条款摘要:对Django REST Framework的YAML支持当前构建状态所有平台:当前发行信息姓名资料下载版本平台类安装...
libbpf-sys从Linux内核维护者到Alexbpf的Rust绑定许可证:BSD-2-Clause libbpf-sys是从Linux内核维护者到Alexbpf的libbpf的Rust绑定:Alex Forster许可证:BSD-2-Clause libbpf-sys是使用bindgen从Linux内核自动生成...