Group By Vs Order By
1. Group By :- It is used to group our result sets of tables in database and is often used with Count, sum, avg etc.
Eg:- SELECT COUNT(state), country
FROM tblcountry
GROUP BY country
2. Order by :- it changes only order in our result set i.e sorting
SELECT COUNT(state), country
FROM tblcountry
ORDER BY country_id