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 statistic will tell the DBA how must space can be reclaimed from dropped table spaces on the next reorg run?
What is the use of db2 optimizer?
List out the three types of page locks that can be held.
What DB2 Catalog column tell you when an index needs table reorganized ?
Hi i need to write a query on the following requirement. SELECT COMM_TEXT INTO :WS_MIKM_COMM_TEXT FROM MPIPROD.MIKMV01 WHERE ACCOUNT_NO = :WFD_ACCOUNT_NO AND (SUBSTR(COMM_TEXT,1,39) = :WS_COMMENT_TEXT AND SUBSTR(COMM_TEXT,47,14) = :WS_DENY_DESC) OR (SUBSTR(COMM_TEXT,1,39) = :WS_COMMENT_TEXT) The above query is to be modified. The requirement is if both the fields are equal then that has to be given priority. In the above query if it satisfies any one it comes out without checking if both being equal is possible.
how to resolve -805 . how to see dbrm and package not found
How do I add a column to an existing table in db2?
What is with ur in db2?
If the cursor is kept open followed the issuing of commit, what is the procedure to leave the cursor that way?
SI Stud name Subject Marks Pass/Fail 1 Sham Maths 40 P 1 Sham Physics 50 P 1 Sham Bio 20 F 2 Ram Maths 40 P 2 Ram Physics 50 P 2 Ram Bio 60 P For the above data , write the SQL query for the student who passed in all the subjects . For eg : I want the data of only Ram coz he passed all subjects .
What is cursor stability in db2?
What is a system catalog table in db2?