How To Use Group Functions in the SELECT Clause

Q

How To Use Group Functions in the SELECT Clause? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements

✍: FYIcenter.com

A

If group functions are used in the SELECT clause, they will be used on the rows that meet the query selection criteria, the output of group functions will be returned as output of the query. The following select statement returns 4 values calculate by 4 group functions on all rows of the "departments" table:

SQL> SELECT COUNT(*), MIN(department_id), 
  2  MAX(department_id) FROM departments;
  COUNT(*) MIN(DEPARTMENT_ID) MAX(DEPARTMENT_ID)
---------- ------------------ ------------------
        27                 10                270

2007-04-20, 4771👍, 0💬