Group by is a requirement for aggregate functions but that is not true the other way around. It is not necessary to have a aggregate functions to have group by in the query.
Eg :
select empno , count(*)
from emp
group by empno
To use count(*) or sum or any other aggregate function we need to use the group by clause.
select empno
from emp
group by empno
We need not require a aggregate function to use a group by clause. The above query just returns all the distinct empnos.
No comments:
Post a Comment