Difference between where and having clause

  • Having clause is used after group by clause whereas where clause is used before group by clause
  • Having clause is used to filter the groups and where clause is used to filter rows

Syntax

select customer_id,Count(*) as visits
from Customer_Info
where age>25
group by customer_id
having Count(*)>10

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑

Design a site like this with WordPress.com
Get started