当前位置:网站首页>Chapter 4 - hierarchical query of SQL query
Chapter 4 - hierarchical query of SQL query
2022-04-21 13:40:00 【Brain storm @ ape】
4.5 Hierarchical query
-
Hierarchical query syntax
-
select Name 1、 Name 2… from Table name start with Starting conditions connect by prior Recursive conditions
-
start with: Specify the starting point of the query , That is, which records to query from
-
connect by prior:
- Specify a recursive condition to get the next record
- prior The location is different , There will be unnecessary query results , See the example below for details .
-
-
-
Yes male_familys Make hierarchical query
-

-
The hierarchy diagram is as follows :
-
prior Placement position -( The top-down ) example :
-
Query grandpa's children's information
- select * from male_familys start with person=‘ grandpa ’ connect by prior person_id= father_id;
-
-

-
Inquire about Dad's children and grandchildren
- select * from male_familys start with person=‘ Dad ’ connect by prior person_id= father_id;
-
-

-
Inquire about my grandchildren
- select * from male_familys start with person=‘ I ’ connect by prior person_id= father_id;
-
-

-
-
prior Placement position -( Top up ) example :
-
Check the information of dad and his immediate family elders
- select * from male_familys start with person=‘ Dad ’ connect by person_id=prior father_id;
-

-
Inquire about elder sister and immediate family elders
- select * from male_familys start with person=‘ sister ’ connect by person_id=prior father_id;
-
-

-
Inquire about the information of grandchildren and their immediate relatives and elders
- select * from male_familys start with person=‘ Grandson ’ connect by person_id=prior father_id;
-
-

-
-
notes : Careful control prior Different placement positions , Search results are also different ! Be a thoughtful person …
版权声明
本文为[Brain storm @ ape]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211217100815.html
边栏推荐
- How to recover if U disk data is lost? U disk data recovery, two schemes completed
- Establishment of binary tree and its cueing
- flink-1.12.0版Yarn安装部署
- Hcip road OSPF expansion configuration
- What are the futures varieties of agricultural products?
- 通讯录的动态实现
- 国际物流集运系统源码,海外仓储跨境转运系统源码
- 跑步运动耳机哪个牌子好、适合运动的耳机
- JDBC 和数据库连接池
- Detailed explanation and demonstration of 3-4dom shaped XSS
猜你喜欢

JDBC and database connection pool

被迫选择了到了外包公司

實現隨機標簽,字體大小、顏色隨機顯示

u盘数据丢失了怎么恢复?u盘数据恢复,2个方案完成

nmap使用

What kind of comfortable sports earphones are recommended

Actual ora2pg is migrated from Oracle11g to PG12 four

Can great talents be of little use? Oceanbase integration scenario test
![leetcode:513. Find the value in the lower left corner of the tree [simply BFS find the first one in each layer]](/img/be/d026b15f89f39944cf03aa0a05d9e3.png)
leetcode:513. Find the value in the lower left corner of the tree [simply BFS find the first one in each layer]

Tailwind core concept - responsive design
随机推荐
北京大学ACM Problems 1009:Edge Detection
Achieve random labels, font size, color random display
前馈神经网络
Code Huffman
AI video cloud vs narrowband HD, who is the darling of the video era
Introduction to SQL database - what & MySQL
The difference between thread library and ASIO Library
SECOND: Sparsely Embedded Convolutional Detection
一份很棒的外设驱动库!(基于STM32F4)
If the field lines are the same, they will be merged into another field SQL statement?
u盘数据丢失了怎么恢复?u盘数据恢复,2个方案完成
Longest ascending subsequence (2) (greedy + dichotomy)
完成数亿元融资后,毫末智行计划超百城落地城市智能驾驶产品
no server suitable for synchronization found
程序员爆出自己的薪资税前月薪15000
Peking University ACM problems 1012: Maya calendar
Flink相关API开发及运行架构和实现原理详解
News compendium of foreign Internet products last week - Angel
Installing and configuring canal
LLVM之父Chris Lattner:编译器的黄金时代
