Skip to interview prep
Apexed

1. What is the difference between WHERE and HAVING?

EasySQL

Technical

Type or dictate your answer. Your draft is saved on this device.

Show model answer

WHERE filters individual rows before grouping; HAVING filters groups after GROUP BY and can use aggregates.

Example: `SELECT customer_id, SUM(amount) FROM orders WHERE status = 'paid' GROUP BY customer_id HAVING SUM(amount) > 500;`

What is the difference between WHERE and HAVING — Data & analytics interview question — Apexed