Database Reference
In-Depth Information
11
Grouping and Summarizing Data
In this chapter:
How do we group and sort with the GROUP BY clause?
What are group functions?
What are aggregate and analytic functions?
What does the HAVING clause do?
What do the ROLLUP, CUBE, and GROUPING SETS clauses do?
1
What is the SPREADSHEET
clause?
This chapter shows you how to aggregate and summarize rows in queries
based on specific columns and expressions, using the GROUP BY clause in
conjunction with various types of functions. Functions can be placed into
various sections of a SELECT statement, including the WHERE clause (see
Chapter 5), the ORDER BY clause (see Chapter 6), the GROUP BY clause
(plus extensions), the HAVING clause, and finally the SPREADSHEET
clause. In this chapter, we start by examining the syntax of the GROUP BY
clause and its various additions, proceed onto grouping functions, and fin-
ish with the SPREADSHEET clause. The SPREADSHEET clause is new
to Oracle Database 10
g
.
11.1
GROUP BY Clause Syntax
In previous chapters you have explored the SELECT, FROM, WHERE,
and ORDER BY clauses, plus methods of joining tables using both an Ora-
cle proprietary join syntax and the ANSI JOIN clause syntax. This chapter
introduces summarizing of query results into groups using the GROUP BY
Search WWH ::




Custom Search