Home >> Oracle >> GROUP BY Clause in Oracle

GROUP BY Clause in Oracle

The GROUP BY used to group the related rows together based on the column value(column on which group by is applied).
After GROUP BY, WHERE command is not used to put restriction for doing this HAVING clause is used.
It is used with aggregate functions (COUNT, MAX, MIN, SUM, AVG) to group the result set by one or more columns.

Syntax

SELECT column1,column2 FROM tablename WHERE condition GROUP BY column1

Exapmle

SELECT  * FROM students GROUP BY student_city HAVING COUNT(*)>1;

Post Your Comment

Next Questions
HAVING Clause
BETWEEN
EXISTS
NOT EXITS
ANY
ALL
MAX
MIN
AVG
COUNT
SUM
What is key
What is Super Key
What is Candidate Key
What is Primary Key
What is Unique Key
What is Foreign Key
Function
Procedure
Cursor
Trigger
Before Trigger
After Trigger
DROP Trigger
DISABLE Trigger

Copyright ©2022 coderraj.com. All Rights Reserved.