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
Can two tables share the same primary key?
What is 3nf normalization?
What are the steps you will take to improve the performance of a poor performing query?
How do database indexes work?
Are resultset updatable?
What is the difference between left and right outer join?
Where sql server usernames and passwords are stored in a sql server?
Explain the concept of recursive stored procedure.
What is a dataset and what are the different types of datasets?
What is coalesce in sql server?
Can we call future method from queueable?
List all types of constraints in sql server?
How to find tables without indexes?
What is the difference between drop table and truncate table?
What are basics of policy management?