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

Is DECLARE TABLE in DCLGEN necessary? Why it used?

3 Answers  


What is check constraint. Explain with example.

0 Answers  


How do you define a correlated name?

1 Answers  


What is dclgen in db2?

0 Answers  


Can a array declared with an index be displayed(readable format) in spool?

4 Answers   Syntel, UST,






what are the frequent DB2 abends did you encounter in your programs ?? What are different SQL abends ??

4 Answers   Xansa,


What is a Cartesian product?

2 Answers  


What is dbrm library?

0 Answers  


Suppose if I need to update a column, how you do that using cursor?

2 Answers   Verizon,


In case if at some point of time db2 is down, would that impact the pre-compilation process of a db2-cobol program?

0 Answers  


How many clustering indexes can be defined for a table?

2 Answers  


What is a LIKE table and how is it created?

2 Answers  


Categories