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

How can we convert between Unix & MySQL timestamps?

1008


Is oracle mysql free?

932


What are the advantages of mysql?

1038


Is sqlite faster than mysql?

993


How can I insert images into a Mysql database?

1110


What is the latest version of mysql?

1035


Does mysql need a server?

983


Why do gaps in sequences occur?

1033


Is mysql a server or database?

942


What are triggers in mysql?

975


How do I create a mysql database?

972


How to get current MySQL version?

1149


1.how to fetch a value and Execute store procudure in mysql(INNODB) using phpMyAdmin? 2.can i wright a package in mysql database(INNODB)?

2581


Where is the mysql config file?

1035


Which is faster mysql or mongodb?

984