当前位置:网站首页>Gbase8s database select has order by Clause 6
Gbase8s database select has order by Clause 6
2022-06-29 12:18:00 【Like to eat radish ice cold】
ORDER SIBLINGS BY Clause
ORDER SIBLINGS BY Clause is valid only in hierarchical queries . Optional SIBLINGS Keyword specifies that the parent row first
Sort , And then sort the child rows of each parent row of each level within the hierarchy .
Some lines have SIBLINGS BY A repeating list of values in the specified column after the keyword , These rows have the same list of values and phase
The rows of the same parent row are arbitrarily sorted . If the hierarchical query contains no SIBLINGS Keywords ORDER BY Son
sentence , According to those who follow ORDER BY Keyword to arrange the order of rows . In hierarchical queries , It's not necessary
ORDER BY Clause , Don't need to, ORDER BY Clause ORDER SIBLINGS BY Options .
The hierarchical query in the following example returns a subset of rows in the hierarchical dataset , Its root is Goyal, Such as the theme Hierarchical query clause in
As listed . This query includes ORDER SIBLINGS BY Clause according to name For those who report to the same manager
Sort employees :
SELECT empid, name, mgrid, LEVEL
FROM employee
START WITH name = ‘Goyal’
CONNECT BY PRIOR empid = mgrid
ORDER SIBLINGS BY name;
Sort the rows returned by this query in the following order :
empid name mgrid level
16 Goyal 17 1
12 Henry 16 2
7 O’Neil 12 3
9 Shoeman 12 3
8 Smith 12 3
14 Scott 16 2
11 Zander 16 2
6 Barnes 11 3
5 McKeough 11 3
9 row(s) retrieved.
Here it is ,START WITH Clause returns... At the root of this level Goyal That's ok . Two subsequent CONNECT BY step
( stay level The pseudo column is marked with 2 and 3) Returns the set of three sibling rows :
Henry、Scott and Zander His parents are Goyal Brother ;
O’Neil、Shoeman and Smith His parents are Henry Brother ;
Barnes and McKeough Make their parents Zander Brother .
Next CONNECT BY Step did not return line , Because it conforms to level = 3 The rows of are leaf nodes in this hierarchy . In this check
At this execution point of the inquiry , take ORDER SIBLINGS BY Apply to result set , Sort the rows in the above order .
Because of the sort key name by VARCHAR Column , Therefore, the returned rows within each sibling's set follow their
employee.name It's worth it ASCII Sequential arrangement . Sort only those siblings of the leaf node in the hierarchy of the returned row
The results of are concentrated and continuous , Because managers follow the employees who report to them , Not their brother . In this example
The exception is Scott, Its child nodes form an empty set .
ORDER BY In Clause SIBLINGS The key word is right SQL Linguistic ISO Extensions to the standard syntax . If you don't pack
Include valid CONNECT BY Clause of a query or subquery ORDER BY Clause includes SIBLINGS keyword , be
SELECT The statement fails with an error .
To learn more about hierarchical queries and CONNECT BY Clause information , see also Hierarchical query clause .
边栏推荐
- Dragon Book tiger Book whale Book gnawing? Try the monkey book with Douban score of 9.5
- Unified exception reporting practice based on bytecode
- MySQL主从同步之 异步复制 半同步复制 全同步复制
- Initial use of eolink
- GBase8s数据库INTO table 子句
- TTChat x Zadig 开源共创 Helm 接入场景,环境治理搞得定!
- 爱可可AI前沿推介(6.29)
- 2022 construction worker civil engineering direction general foundation (construction worker) theoretical question bank simulation test platform operation
- 智能垃圾桶(四)——树莓派pico实现超声波测距(HC-SR04)
- Ttchat x Zadig open source co creates helm access scenarios, and environmental governance can be done!
猜你喜欢

【JUC系列】同步工具类之ThreadLocal

&3 在浏览器中查看请求报文和响应报文

AUTOCAD——文字显示方式、CAD怎么直接打开天正图纸

Titanium dynamic technology: our Zadig landing Road

论文复现——AC-FPN:Attention-guided Context Feature Pyramid Network for Object Detection.

爱可可AI前沿推介(6.29)

易快报:我们用 Zadig 实现万次构建部署,聪明运维,释放开发生产力

年轻就要醒着拼,年轻就要勇于尝试

Embedded database development programming (IV) -- DDL, DML

保障饮用水安全!番禺沙湾水道水质在线监测系统通过验收
随机推荐
2022 question bank and simulation test for documenter post skills (documenter) operation certificate examination
ERP编制物料清单 金蝶
Pytoch - distributed communication primitive (with source code)
ArtBench:第一个类平衡的、高质量的、干净注释的和标准化的艺术品生成数据集
cmake 报错
高校如何基于云原生构建面向未来的智慧校园?全栈云原生架构VS传统IT架构
GBase8s数据库select有HAVING 子句
GBase8s数据库select有ORDER BY 子句6
正大期货留4数据整合
镜像漏洞扫描工具:Trivy
杰理之关于 TWS 交叉配对的配置【篇】
易快报:我们用 Zadig 实现万次构建部署,聪明运维,释放开发生产力
ERP编制物料清单 华夏
GBase8s数据库对 STANDARD 或 RAW 结果表排序
GBase8s数据库select有ORDER BY 子句5
[VTK] MFC grid editor based on vtk8.2
& 4 express framework
杰理之关于开机发起回连对耳的位置:【篇】
MySQL主从同步之 异步复制 半同步复制 全同步复制
Jericho's position on initiating the connection back to the opposite ear: 【 chapter 】