Oracle Group By | Group By - oracle tutorial - sql tutorial




What is Oracle GROUP BY clause ?

  • The Oracle GROUP BY clause is used in a SELECT statement to collect data across multiple records and group the results by one or more columns
oracle tutorial , sql tutorial , sql , pl sql tutorial , oracle , pl sql , plsql

Syntax:

SELECT expression1, expression2, ... expression_n, 
aggregate_function (expression)
FROM tables
[WHERE conditions]
GROUP BY expression1, expression2, ... expression_n;
click below button to copy the code. By - oracle tutorial - team
Oracle having group by clause

Oracle Group By - Having Clause

Example:

SELECT orderid, COUNT(*) AS "Number of orders" 
FROM orders 
GROUP BY orderid
click below button to copy the code. By - oracle tutorial - team

Using Count function

Sample Database

  • We have a table called orders with three fields (id, customer_name, and orderid).
 sample database


Group by using Count Function

 count function
  1. Using aggregate function (Count) we are ordering the Order ID from orders table and grouping them by Number of Orders.
  2. The number of orders has sorted according to the order ID.

This tutorial provides an indepth knowledge on the following items such as oracle tutorial , sql tutorial , sql , pl sql tutorial , oracle , pl sql , mysql tutorial , sql tutorial for beginners , learn sql , oracle database tutorial , sql query tutorial , oracle dba tutorial , plsql tutorial , oracle tutorial pdf , oracle pl sql tutorial , oracle sql tutorial , sql tutorial point , oracle tutorial for beginners , learn oracle online free , learn oracle online , learning pl sql programming , learn sql online for free , sql learning online , dba oracle tutorial , oracle sql tutorial advanced , oracle 11g dba tutorial with examples , oracle online learning , oracle learning online , how to learn pl sql , sql coding tutorial , sql learning websites , sql basic learning

Related Searches to Group By | GROUP BY