Loading topic
CONNECT BY. Here you build the table and learn to read it. You also learn where plain joins stop working.6 min reademployees table from Oracle's HR sample schema. Each row has an employee_id6 min readSELECT with WHERE and ORDER BY, that you understand primary and foreign keys, and that you have written a self-join on a table such as employees. It also assumes you know the DUAL table. The previous chapter introduced START WITH and `CONNECT BY6 min readSTART WITH, CONNECT BY and PRIOR. It also assumes you know the employees table, where manager_id points back to employee_id in the same table. The chapter explains the LEVEL pseudocolumn: what it holds, where you can us6 min readSTART WITH ... CONNECT BY PRIOR query and that you know what LEVEL returns. It also assumes you are comfortable with LPAD and the || concatenation operator. Here you turn the flat list a hierarchical query returns into text that looks like an org ch6 min readSTART WITH, CONNECT BY PRIOR and LEVEL, and that you have seen the LPAD indentation trick. Here you learn how to control the order of rows inside each branch without breaking the tree layout.5 min readSTART WITH and CONNECT BY PRIOR, and that you know what LEVEL returns. The examples use the employees table, where `manag5 min readSTART WITH, CONNECT BY PRIOR and LEVEL. The examples use the employees table from Oracle's HR sample schema. Each row has an employee_id, a manager_id, a last_name and a salary.5 min readSYS_CONNECT_BY_PATH builds the route from the root to each row, and CONNECT_BY_ROOT returns a value from the row where that route started. It assumes you can already write a top-down query with START WITH, `CONNECT BY 5 min readCONNECT_BY_ISLEAF pseudocolumn, so you don't need a second query or a self-join.5 min readSTART WITH, CONNECT BY PRIOR and LEVEL, and that you know what a self-referencing table is. Here you will see what happens when the parent-child links form a loop, how to get rows back anyway with NOCYCLE, and how to find the b5 min readSTART WITH ... CONNECT BY PRIOR query. It also assumes you know LEVEL and CONNECT_BY_ROOT, and standard GROUP BY aggregation. The examples use the employees table, where manager_id points back to employee_id.5 min readSTART WITH, CONNECT BY and PRIOR, and that you know what the LEVEL pseudocolumn returns. You also need to be comfortable with the DUAL table and with joins. Here you will use CONNECT BY for something other than trees: pro5 min readSTART WITH ... CONNECT BY PRIOR query and know LEVEL, ORDER SIBLINGS BY, pruning, and NOCYCLE. You will see the same org-chart query written both ways. You will then learn which CONNECT BY features have a recursive WITH equivalent and which choi6 min readCONNECT BY query. It also assumes you can read an Oracle execution plan at a basic level (EXPLAIN PLAN and DBMS_XPLAN). It explains where the cost of a hierarchical query comes from and which indexes and query shapes keep it small.6 min read