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
In an sql table that is embedded, what is the procedure to retrieve rows that are part of a db2 table?
Mention the different locking levels that are available in db2.
Is ibm db2 free?
What is null value in db2?
What are the different types of base tables?
How do I start db2 in windows?
What is dbrm? When it will be created?
Explain packages.
Is db2 a programming language?
What is db2 look?
What is data manager?
What is table space in db2?
Which component is responsible for processing sql statements and selecting access paths?
Explain correlated sub-queries.
by using cursors , we can access particular records from the table based on some condition, i want to delete those selected records, how can we write a query for this in the program?