What is the difference between group by and order by?
Answers were Sorted based on User's Feedback
Answer / sunil1405
Group By controls the presentation of rows , order by
controls the presentation of columns.
| Is This Answer Correct ? | 15 Yes | 7 No |
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 |
What is an intent lock?
how to u check the query is executing or not ?where will u check for sqlcode ?
What is the difference between plan and package in db2?
In cursor program-1 can we create another cursor program-2 inside the cursor program-1.If yes how/no why ?
What is DCLGEN?
db2 maintains information about the data... a.in tables. b.in a set of tables known as db2 catalog. c.in db2 database. d.none of the above.
How to select the duplicate rows from a table?
How to test SQL -911 error while developing COB-DB2 program
How can you find out the # of rows updated after an update statement?
What are the four lockable units for DB2?
Parm value passed is PARM=(10,20). how do code linkage section and how would you add these two passes values and show result in cobol program.
How do you simulate the EXPLAIN of an embedded SQL statement in SPUFI/QMF? Give an example with a host variable in WHERE clause)