5
Reply

Difference Between ORDER BY Clause and GROUP BY Clause in SQL?

Deepak Verma

Deepak Verma

Apr 05, 2011
9.7k
0

    http://www.essentialsql.com/what-is-the-difference-between-group-by-and-order-by/

    Munesh Sharma
    June 19, 2015
    0

    Order By is used for sorting of data either in ascending order or in descending order where Group By is used for combining the value of unique combination .Group by used when any aggregate function is used in query..

    Rahul Prajapat
    May 30, 2015
    0

    Order By is used for sorting of data either in ascending order or in descending order where Group By is used for combining the value of unique combination .Group by used when any aggregate function is used in query..

    On the surface both clauses appear to do the same thing, that is sort data. But this is where their similarities end. Both serve entirely different purposes. -> ORDER BY clause's purpose is to sort the query result by specific columns. -> GROUP BY clause's purpose is summarize unique combinations of columns values.

    Nirav Vasoya
    April 21, 2015
    0

    ORDER BY alters the order in which items are returned.

    GROUP BY will aggregate records by the specified columns which allows you to perform aggregation functions on non-grouped columns (such as SUM, COUNT, AVG, etc)

    Sathish DV
    April 06, 2011
    0