GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL
Go To First  |  Previous Question  |  Next Question 
 SQL  |  Question 168 of 171    Print  
how many columns can be in the group by clause

  
Total Answers and Comments: 10 Last Update: August 17, 2009     Asked by: radha11 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Srinivas4u
 

I am sure that a group by clause can have all columns which are there in that table,not sure if you are looking for anotehr answer



Above answer was rated as good by the following members:
darshan23m, deepu_478, goru.ravindra, salauddina.87, karthikbhupathy, kbjit
July 16, 2008 10:14:55   #1  
Srinivas4u Member Since: July 2008   Contribution: 1    

RE: how many columns can be in the group by clause

I am sure that a group by clause can have all columns which are there in that table not sure if you are looking for anotehr answer


 
Is this answer useful? Yes | NoAnswer is useful 4   Answer is not useful 1Overall Rating: +3    
July 22, 2008 01:45:14   #2  
krishnaveni_g Member Since: July 2008   Contribution: 10    

RE: how many columns can be in the group by clause
The columns which are used in the SELECT statement with GROUP BY function are compulsory used in the GROUP BY clause.
 
Is this answer useful? Yes | No
July 28, 2008 08:25:39   #3  
nsr.nandu Member Since: July 2008   Contribution: 1    

RE: how many columns can be in the group by clause
When you mention a column name in GROUP BY Cluase you must mention the same in SELECT statement
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 2Overall Rating: -1    
August 30, 2008 13:58:11   #4  
rajaraddi Member Since: August 2008   Contribution: 1    

RE: how many columns can be in the group by clause
For Aggregation:
No. of cols in group by clause No. of cols in SELECT clause - No. of cols to be aggregated.

For eliminating the duplicates
No. of cols in group by clause No. of cols in SELECT clause.

In general there might be n number of cols that can be used in the group by clause which depends on
your number of cols present in SELECT clause

Thanks
Raju

 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    
September 01, 2008 05:26:43   #5  
raghuprasad Member Since: August 2007   Contribution: 23    

RE: how many columns can be in the group by clause
There can be as many as all the number of columns of the table which can be used in the GROUP BY clause. Oracle Server handle of this itself.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
January 09, 2009 13:54:42   #6  
Vishuraj Member Since: January 2009   Contribution: 3    

RE: how many columns can be in the group by clause
All the columns in the table can be taken in as Group by clause...
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
February 16, 2009 08:56:02   #7  
manduauce Member Since: May 2008   Contribution: 1    

RE: how many columns can be in the group by clause
The columns which are mentioned in group by clause should also be mentioned in select statement except for aggrerations.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
August 03, 2009 05:44:14   #8  
harit79 Member Since: November 2008   Contribution: 7    

RE: how many columns can be in the group by clause
If we are using aggregate function in select clause then there should be one column in group by clause Let me explain with the example.

Select max(sal) min(hire_date) ename lastname
from emp
where lastname like '_a '
group by ename;

So you have to use atleast one column (No aggregate funciton).

 
Is this answer useful? Yes | No
August 15, 2009 02:21:05   #9  
sangeetapanda6 Member Since: August 2009   Contribution: 1    

RE: how many columns can be in the group by clause
A GROUP BY clause can display the number of columns that are used in the SELECT statement.
 
Is this answer useful? Yes | No
August 17, 2009 13:13:49   #10  
Priya Murugesan Member Since: August 2009   Contribution: 2    

RE: how many columns can be in the group by clause
The columns which are used in SELECT clause should appear in GROUP BY clause except the column used in aggregate function.
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape