In this chapter, we've added the final two clauses to our SELECT
statements—GROUP
BY
and HAVING
. We have used these two clauses to enable the grouping of rows for operations such as data analysis. We have examined the use of multi-row, or aggregate, functions to perform operations on a set of data in our SELECT
statements. We then combined the grouping clauses and multi-row functions to compute group operations and display them in their respective groups. Finally, we brought all of our SQL clauses together to perform complex operations.
Although we may have come to the last of our SQL clauses, there is still more work to be done. In our next chapter, we'll learn a new SQL technique—subquerying. Using subqueries, we can nest queries inside of each other to combine data from tables in new ways. We'll follow that subject up by looking at set operations and set theory in Oracle.