What's the difference between WHERE and HAVING?

Explain how WHERE and HAVING work. How do you decide where a filtering condition belongs?

ExplainGROUP BY / HAVINGJuniorAnalystData EngineerBackendQA