What is the difference between group by and order by?

Answers were Sorted based on User's Feedback



What is the difference between group by and order by?..

Answer / sunil1405

Group By controls the presentation of rows , order by
controls the presentation of columns.

Is This Answer Correct ?    15 Yes 7 No

What is the difference between group by and order by?..

Answer / 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

More DB2 Interview Questions

what is sql abend code -801,-802?

2 Answers  


What is the database descriptor?

2 Answers  


What is an alias?

3 Answers  


Can a primary key have null values? If we try to insert a null value in a primary key column, will it work or give an error code?

6 Answers  


Hi, i would like to start a new carrier in DB2 DBA.Which and what all step should i have to take..?

0 Answers  






Define predicate?

0 Answers  


What is the purpose of the QUIESE Utility?

1 Answers  


I have a DB2 table which has 1000 rows.after udatingg first 110 rows, my job abends. Now what I have to do if I want to restart the job next time so that it should start updating from 111th row (without updating first 110 rows again).

10 Answers   Cap Gemini, Wipro,


What does db2 blu stand for?

0 Answers  


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

0 Answers  


How do I create a table MANAGER (EMP-NO, MANAGER) where MANAGER is a foreign key which references to EMP-NO in the same table? Give the exact DDL.

3 Answers  


Can we insert update delete in view?

0 Answers  


Categories