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?

Answer Posted / visakh viswanath

Difference between order by and group by having ?

suppose i have students table which has id number ,sname
varchar2(20),marks1number ,marks2 number,marks3 number,age
number.

i would like to illustrate what i understood
suppose i want to select students whose id > 2000 and age
>30

my query would be like this
select * from students where id >2000 and age >30 order by
age desc ;
or
else
select * from students group by age ,id having age >30 and
id >2000 ;

so both the queries would be same but in the first one i
use order by followed by my condition in where .
in second once i used group by which would group according
to the age or id and then having is same as where condition
in the above .

Is This Answer Correct ?    3 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is db2 optimizer?

1302


What are iseries servers?

1126


What is the role of data manager in the db2 database?

1154


How can deadlocks be resolved?

985


What is the syntax for FETCH in DB2 ?

1263


How to retrieve rows from a db2 table in embedded sql?

1438


What is the advantage in De-normalizing tables in DB2?

1227


Mention the downsides of page level lock.

1212


in my project..TEST is db2 8.1 version In PROD it is 7.1 if i do REORG in TEST.. can I use the same REORG jcl with out modification in PROD region (this is DB2 8.1 )? if not, what modification i need to do in my REORG control card?

2155


Why cursor is used in db2?

1084


What are db2 objects?

1084


What is cursor in dbms?

1110


Explain the contention situations caused by locks?

1138


What is the use of with ur in db2?

1108


Where can you declare a cursor in a cobol-db2 program?

1136