GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Oracle  >  General
Go To First  |  Previous Question  |  Next Question 
 General  |  Question 190 of 210    Print  
what is the difference between groupby and orderby?

  
Total Answers and Comments: 5 Last Update: April 06, 2006   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 10, 2005 02:35:59   #1  
jayashree a        

RE: what is the difference between groupby and orderby?
Group by is used to group set of values based on one or more values. 
Order by is to sort values either in ascending or descending order

 
Is this answer useful? Yes | No
August 16, 2005 18:02:21   #2  
rkanth18        

RE: what is the difference between groupby and orderby?
group by is used when we use aggregate functions on the columns in a query the other columns should be in group by query  
 
eg:  
 
select empno,ename,sum(sal) from emp 
group by empno,ename 
 

 
Is this answer useful? Yes | No
March 23, 2006 07:06:31   #3  
Venkat80 Member Since: March 2006   Contribution: 4    

RE: what is the difference between groupby and orderby...

Group by is used to get the set of records belongs to the same group.

For Example

Select count(empno),deptno from emp group by  dept

The above statement will display number of records for each department. In the same way we can all agregate functions like sum,avg etc

In group by we can select only the column(s) which are mentioned in group by clause.  In above example we can't select other than deptno and agregate functions of any other columns.

Order by is display the records either in asscending or descending order. What ever the column(s) we are mentioning in the order by clause that column(s) must be exists in selct clause also.  We can select all other columns which are not mentioned in order by clause.

For example

Select empno, ename,deptno from emp order by ename.

ename must be in select clause

we can select other than ename also, but we cant use any aggregate functions here.


 
Is this answer useful? Yes | No
March 30, 2006 23:18:31   #4  
Neelam Jain        

RE: what is the difference between groupby and orderby...

groupby clause is used to group the set of record. groupby clause is used with having clause.whereas order by clause is used to sort th record either acc. or dec. order


 
Is this answer useful? Yes | No
April 05, 2006 22:39:59   #5  
manu        

RE: what is the difference between groupby and orderby...

   Using group by we get set of records for particualar value or content  in column ;

Means it is usde to get group of records for selecting column or grou[

While Order by is used to get sorting list of  records .


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape