Advertisements
Advertisements
Question
Differentiate between order by and group by command.
Distinguish Between
Advertisements
Solution
| Basis of Difference | ORDER BY | GROUP BY |
|---|---|---|
| Purpose | Sorts result rows | Forms groups of similar values |
| Main use | Ascending or descending arrangement | Aggregate calculations by group |
| Common functions | Not necessary | Used with SUM(), COUNT(), AVG() etc. |
| Result | Ordered rows | One result row per group |
| Example | ORDER BY price DESC |
GROUP BY scode |
shaalaa.com
Is there an error in this question or solution?
