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 Reply

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

Blog at WordPress.com.

Up ↑

Create your own website, free on WordPress.com.Create your own website.
Start free