Why we need a group by clause?

Answers were Sorted based on User's Feedback



Why we need a group by clause?..

Answer / sd

While using aggregate functions.

Is This Answer Correct ?    7 Yes 1 No

Why we need a group by clause?..

Answer / vampire007

We use GroupBy clause to analyze data in table,by means of
various sql server aggregate functions like SUM(), AVERAGE
() etc., according to some domain.

For eg., If we want to know the sales done by a every
employee, then we would use somewhat this kind of query:

/**
select employeeid, count(*)
from orders
groupby employeeid
order by employeeid
**/

Is This Answer Correct ?    7 Yes 1 No

Why we need a group by clause?..

Answer / satyanarayana

In order to provide a condition to the select statement
either by group by column or aggregate function

Is This Answer Correct ?    1 Yes 0 No

Why we need a group by clause?..

Answer / ricky

while we are using a aggregate function we use the group by
clause....

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More SQL Server Interview Questions

Where the sql logs gets stored? : sql server database administration

0 Answers  


What are the steps you can take to avoid “deadlocks”?

0 Answers  


How sql server executes a statement with nested subqueries?

0 Answers  


Which command is used for user defined error messages?

0 Answers  


create procedure proc1 (@a int) as begin if @a=1 create table #temp(a1 int) else create table #temp(a1 int) end while executeing the above code it shows error like '#temp already exist' .why it shows an error?

8 Answers   IBM,






IN Vs OR operator which is best to use sql server.

4 Answers  


Is it possible in sql table to have more than one foreign key?

0 Answers  


What is the difference between windows authentication and sql server authentication

7 Answers   HCL,


hi i gone though satyam interview. what is Acid Properties?

2 Answers   Satyam,


how we can use a database with php.

2 Answers   HCL, IT Solution,


What is data source object?

0 Answers  


write an SQL query to list the employees who joined in the month of January?

0 Answers   Agilent, Amdocs,


Categories