Difference between "having" and "where"

Hi everyone,

Can anyone help give me some more examples about difference between “having” and “where”?

Thanks!

1 Like

The main difference between WHERE and HAVING clause is, WHERE is used for row operations and HAVING is used for column operations. … The WHERE clause is used to filter records from a result. The filtering occurs before any groupings are made.

I hope this helps =)

1 Like

The WHERE clause is always called first. This means it can’t be used on groups (GROUP BY) and aggregate functions. HAVING executes after everything is grouped this means having CAN be used on groups and aggregate functions.

source

2 Likes

It helped a lot!! :slight_smile:
Thanks and have a great dayyy<3

1 Like

Aha! Thank you so much for the comment!
Have a great day:) <3