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

Can two tables share the same primary key?

523


What is 3nf normalization?

570


What are the steps you will take to improve the performance of a poor performing query?

609


How do database indexes work?

547


Are resultset updatable?

535






What is the difference between left and right outer join?

559


Where sql server usernames and passwords are stored in a sql server?

504


Explain the concept of recursive stored procedure.

502


What is a dataset and what are the different types of datasets?

93


What is coalesce in sql server?

545


Can we call future method from queueable?

597


List all types of constraints in sql server?

522


How to find tables without indexes?

636


What is the difference between drop table and truncate table?

497


What are basics of policy management?

622