Skip to main content
SQL • LESSON 91

JOIN with HAVING

How can we find customers who placed more than five orders?

Advanced3 Minutes1040 XP
🤔 THE QUESTION

How can we find customers who placed more than five orders?

💡 WHAT IS IT?

HAVING filters aggregated joined rows, identifying accounts that meet high-frequency engagement thresholds.

🎯 WHAT IS IT USED FOR?

VIP customer identification, loyalty reward tier segmentation, frequent buyer analytics.

💻 EXAMPLE
SELECT c.customer_name, COUNT(o.order_id) AS order_count
FROM customers c
JOIN orders o
ON c.customer_id = o.customer_id
GROUP BY c.customer_name
HAVING COUNT(o.order_id) > 5;

🎯 Mission Objectives

Practice typing production-grade SQL code for JOIN with HAVING.

  • JOIN + HAVING
  • VIP segmentation
  • Order frequency thresholds
  • Customer loyalty analysis