Database Reference
In-Depth Information
Figure 11.10
Artists Who Have
Spent Time in the
Studio.
Note in Figure 11.10 how functions can call other functions where, for
instance, the DECODE function calls the COUNT function.
11.4
Using the GROUP BY Clause
We have seen a lot of use of the GROUP BY clause so far in this chapter.
Let's now attempt to explain what the GROUP BY clause is and what it
does. In its simplest form, the GROUP BY clause can be used to summa-
rize rows into a group or groups of rows based on a grouping function
placed into the SELECT clause. The HAVING clause can then be used to
filter out unwanted groups much like the WHERE clause (see Chapter 5)
applied to a SELECT statement. The ROLLUP and CUBE clauses are
used to produce groups of groups or super aggregates, and the GROUP-
ING SETS clause can make grouping more efficient by removing rows
before aggregation.
 
Search WWH ::




Custom Search