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
What happens when converting big values to integers?
What is store procedure? When do you use?
Explain system functions or built-in functions? What are different types of system functions?
When do you think a developer should use sql server-based cursors?
how to take backup bcp out for a column in table in sql server?
between cast and convert which function would you prefer and why?
Does full backup break log chain?
Explain the various types of concurrency problem. I.e. Lost or buried updates, uncommitted dependency, inconsistent analysis, phantom read?
What is an expression in ms sql server?
can an order by clause be used in a creation of a view?
What are the types of indexing?
What are the different types of collation sensitivity?
Write an sql query to find first weekday of the month?
Can we join two tables without primary key?
what is a join and explain different types of joins? : Sql server database administration