What is use of group by? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is use of group by?

difference between that and order by

24th Mar 2018, 11:02 AM
Sina Zare
Sina Zare - avatar
1 Answer
+ 1
Group by helps you to group the output with any particular attribute while order by helps you to order the output according to given attribute for example: if you have 4employees with their respective salaries in CSE dept then "select deptid, SUM(salary) AS salaries from dept group by deptid" returns the combined salaries of all the 4employees in CSE dept. "Order by deptid" returns the salaries of employees in ascending of their id's.
27th Mar 2018, 8:19 AM
Mahesh Kasindi
Mahesh Kasindi - avatar