Can Having clause be used without Group by clause?

Answers were Sorted based on User's Feedback



Can Having clause be used without Group by clause?..

Answer / phani

we can use, but select columns and having columns should
use with aggregare functions

ex:
select max(empid), min(marks)
from employee
having max(empid_id)>100

Is This Answer Correct ?    72 Yes 16 No

Can Having clause be used without Group by clause?..

Answer / debasish

we can use having clause without group bu clause .but it
will act as where clause

Is This Answer Correct ?    68 Yes 33 No

Can Having clause be used without Group by clause?..

Answer / sumathy

HAVING Clause
Specifies a search condition for a group or an aggregate.
HAVING is usually used with the GROUP BY clause. When GROUP
BY is not used, HAVING behaves like a WHERE clause.

Reference:
http://msdn.microsoft.com/en-us/library/aa259187
(SQL.80).aspx

Is This Answer Correct ?    30 Yes 3 No

Can Having clause be used without Group by clause?..

Answer / pradip jain

select max(empno) from dbo.Employee having count(EmpNo)=9

it has no meaning so it will show zero record

Is This Answer Correct ?    17 Yes 6 No

Can Having clause be used without Group by clause?..

Answer / shailesh yadav

Yes HAVING caluse can be use without GROUP BY. the SQL HAVING clause is often used with the GROUP BY clause. If the GROUP BY clause is omitted, the MySQL HAVING clause behaves like the WHERE clause. Notice that the MySQL HAVING clause applies the condition to each group of rows, while the WHERE clause applies the condition to each individual row.

Is This Answer Correct ?    6 Yes 2 No

Can Having clause be used without Group by clause?..

Answer / anilreddy

No,we can not use.If there is Having it must followed by Group By

Is This Answer Correct ?    6 Yes 52 No

Post New Answer

More SQL Server Interview Questions

What is the command dbcc checkdb used for?

0 Answers  


how can you move the master database

1 Answers   IBM,


What does the on update no action do?

0 Answers  


What does it mean to invest in the index?

0 Answers  


how we can use a database with php.

2 Answers   HCL, IT Solution,






How can you check the version of sql server?

0 Answers  


How to Install SQL SERVER 2005 remotely?

1 Answers   IBM,


If you are given access to a SQL Server, how do you find if the SQL Instance is a named instance or a default instance?

0 Answers  


Find nth lowest salary or get nth lowest salary?

0 Answers  


Can group functions be used in the order by clause in ms sql server?

0 Answers  


Can the query output be sorted by multiple columns in ms sql server?

0 Answers  


Can group by be used without aggregate functions?

0 Answers  


Categories