Ocp1z0-047:connect by prior hierarchy query

Source: Internet
Author: User

You want to get the employee table using Top-down hierarchical hierarchical data, and that's obviously the answer is: E

Finally, the next example adds Astart with clause to specify a root row for the hierarchy, and a order byclause using the Siblings keyword to preserve ordering within the hierarchy:

Hr@ocm> SELECT last_name,employee_id, manager_id, Level

2 from Employees

3 START with employee_id =100

4 CONNECT by prioremployee_id = manager_id

5 Order siblings Bylast_name;

Last_Name employee_id manager_id Level

------------------------------------ ---------- ----------

King 100 1

Cambrault 148 100 2

Bates 172 148 3

Bloom 169 148 3

Fox 170 148 3

Kumar 173 148 3

Ozer 168 148 3

Smith 171 148 3

De Haan 102 100 2

Hunold 103 102 3

Austin 105 103 4

Ernst 104 103 4

Lorentz 107 103 4

Pataballa 106 103 4

Errazuriz 147 100 2

Ande 166 147 3

Banda 167 147 3

Greene 163 147 3

Lee 165 147 3

Marvins 164 147 3

Vishney 162 147 3

Fripp 121 100 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.