what is the difference between group and having
give an example with query and sample output

Answer Posted / manub22

- GROUP BY clause works on the rows returned by a SELECT Query. This clause summaries identical rows into a single/distinct group and returns a single row with the summary for each group, by using appropriate Aggregate function in the SELECT list, like COUNT(), SUM(), MIN(), MAX(), AVG(), etc.

- HAVING clause works as a Filter on top of the Grouped rows returned by the Query containing the GROUP BY clause. This clause cannot be replaced by a WHERE clause and vice-versa.

Check the difference b/w GROUP BY & HAVING, link: http://sqlwithmanoj.com/2015/05/23/sql-basics-difference-between-where-group-by-and-having-clause/

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Mention the different authentication modes in sql server.

522


How to change parameter value inside the report?

104


How to stop log file growing too big?

565


Where views are stored in sql server?

550


How to enable tcp/ip protocol on a sql server?

581






What is a linked server in sql server?

567


What area unit the various kinds of info compression introduced in sql server 2008?

560


Suppose you want to implement the many-to-many relationships while designing tables. How would you do it?

535


What is the dbcc command and why is it used?

560


How to include date and time values in sql statements?

621


How to use order by with union operators in ms sql server?

566


Does the unique constraint create an index?

555


What is normalization 1nf 2nf 3nf?

620


What are the instances when triggers are appropriate?

514


How to declare a cursor with "declare ... Cursor" in ms sql server?

559