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
What is buffer pool and list some of them?
What are the 2 sqlcodes that are returned?
What is scrollable cursor in db2?
can all users have the privilage to use the sql statement select * (dml)?
What r the comman abends in db2, jcl and cobol???????
How is the value function used?
Is db2 a mainframe database?
What is performance tuning db2?
What is the use of predicate?
When do you specify the isolation level?
What is the maximum No of rows per page?
How do I import a csv file into db2?
What is the difference between cursor stability and repeatable read isolation levels?
What does db2 blu stand for?
What is dbrm in db2 database?