Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the difference between GROUP BY and ORDER BY in
Sql?

Answer Posted / niraj kumar

To sort a result, use an ORDER BY clause.
The most general way to satisfy a GROUP BY clause is to
scan the whole table and create a new temporary table where
all rows from each group are consecutive, and then use this
temporary table to discover groups and apply aggregate
functions (if any).
ORDER BY [col1],[col2],...[coln]; Tells DBMS according to
what columns it should sort the result. If two rows will
hawe the same value in col1 it will try to sort them
according to col2 and so on.
GROUP BY [col1],[col2],...[coln]; Tells DBMS to group
(aggregate) results with same value of column col1. You can
use COUNT(col1), SUM(col1), AVG(col1) with it, if you want
to count all items in group, sum all values or view
average.

Is This Answer Correct ?    24 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why should I use mysql?

877


List data types in mysql? Explain

874


What's the difference between mysql and sql server?

928


How to store binary data in mysql?

960


How to connect html form to mysql database using php?

888


Can mysql handle big data?

900


What is a select query?

813


What is sqlyog?

985


What is 'mysqlshow'?

989


What is the date format in mysql?

824


Can we rollback truncate in mysql?

948


What is 'mysqlcheck'?

965


What is a definer?

826


What is mysql database extension?

966


How many columns is too many mysql?

846