Professional Documents
Culture Documents
40058GC11
Production 1.1
November 2001
D34074
Authors Copyright © Oracle Corporation, 2000, 2001. All rights reserved.
Publisher
Sheryl Domingue
Contents
I Introduction
Course Objectives I-2
Course Overview I-3
iii
3 Enhancements to the GROUP BY Clause
Objectives 3-2
Review of Group Functions 3-3
Review of the GROUP BY Clause 3-4
Review of the HAVING Clause 3-5
GROUP BY with ROLLUP and CUBE Operators 3-6
ROLLUP Operator 3-7
ROLLUP Operator Example 3-8
CUBE Operator 3-9
CUBE Operator: Example 3-10
GROUPING Function 3-11
GROUPING Function: Example 3-12
GROUPING SETS 3-13
GROUPING SETS: Example 3-15
Composite Columns 3-17
Composite Columns: Example 3-19
Concatenated Groupings 3-21
Concatenated Groupings Example 3-22
Summary 3-23
Practice 3 Overview 3-24
4 Advanced Subqueries
Objectives 4-2
What Is a Subquery? 4-3
Subqueries 4-4
Using a Subquery 4-5
Multiple-Column Subqueries 4-6
Column Comparisons 4-7
Pairwise Comparison Subquery 4-8
Nonpairwise Comparison Subquery 4-9
Using a Subquery in the FROM Clause 4-10
Scalar Subquery Expressions 4-11
Scalar Subqueries: Examples 4-12
Correlated Subqueries 4-14
Using Correlated Subqueries 4-16
Using the EXISTS Operator 4-18
Using the NOT EXISTS Operator 4-20
Correlated UPDATE 4-21
The WITH Clause 4-26
WITH Clause: Example 4-27
Summary 4-29
Practice 4 Overview 4-31
iv
5 Hierarchical Retrieval
Objectives 5-2
Sample Data from the EMPLOYEES Table 5-3
Natural Tree Structure 5-4
Hierarchical Queries 5-5
Walking the Tree 5-6
Walking the Tree: From the Bottom Up 5-8
Walking the Tree: From the Top Down 5-9
Ranking Rows with the LEVEL Pseudocolumn 5-10
Formatting Hierarchical Reports Using LEVEL and LPAD 5-11
Pruning Branches 5-13
Summary 5-14
Practice 5 Overview 5-15
A Practice Solutions
B Table Descriptions and Data
C Writing Advanced Scripts
D Oracle Architectural Components
Index
Additional Practices
Additional Practice Solutions
Additional Practices: Table Descriptions and Data
v
vi