Group Functions

Average, Sum, Distinct, Maximum, Minimum, Count:


The Avg function returns the average value of an expression.

Output: SQLFUN28



The SQL SUM function returns the summed value of an expression.


Maxmimum and Minimum:

The SQL MAX and MIN function returns the maximum and minimum value of an expression.



The SQL COUNT function returns the number of rows in a query.


Group By; Group By with Having; Group By with Where, Having and Order By:

Group By:

The SQL GROUP BY clause can be used in an SQL SELECT statement to collect data across multiple records and group the results by one or more columns.


Group By with Having:

  • Oracle GROUP BY HAVING can be used to limit the returned rows after the grouping.  With Oracle GROUP BY HAVING, the HAVING clause is applied after the GROUP BY has taken place.
  • Oracle GROUP BY HAVING will group values that have a particular value. Oracle GROUP BY HAVING can be used in conjunction with other logical functions such as MIN, MAX, COUNT, and SUM.
  • With Oracle GROUP BY HAVING, the HAVING clause filters rows after the grouping with the Oracle GROUP BY clause.An example of Oracle GROUP BY HAVING using the MAX function can be seen below:


    Group By with Where:


    Having clause:

    The SQL HAVING clause is used in combination with the SQL Group By Clause. It can be used in an SQL Select Statement to filter the records that a SQL GROUP BY returns.


    Order By:

    The SQL ORDER BY clause allows you to sort the records in your result set. The SQL ORDER BY clause can only be used in SQL Select Statement.



Leave a Reply