© Ben Brumm 2019
Ben BrummBeginning Oracle SQL for Oracle Database 18chttps://doi.org/10.1007/978-1-4842-4430-2_25

25. Grouping Your Results

Ben Brumm1 
(1)
Melbourne, VIC, Australia
 

In the last chapter, you learned about aggregate functions. These functions calculated a value, such as a sum or a count, over the values in a column and showed you a single row of results. In this chapter, you’ll learn how to write a query that groups your results. What does that mean?

Grouping Your Data

To understand the concept of grouping data, let’s take a look at the employee table.
SELECT id, last_name, salary, office_id
FROM employee;

ID

LAST_NAME

SALARY

OFFICE_ID

1

JONES

30000

1

2

SMITH

35000

2

3

KING

45000

2

4

SIMPSON

52000

1

5

ANDERSON

31000

(null)

6

COOPER

(null)

1

7

ADAMS

(null)

3

8

SMITH

62000 ...

Get Beginning Oracle SQL for Oracle Database 18c: From Novice to Professional now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.