Skip to main content
SQL โ€ข LESSON 185

Customer Lifetime Value

How can we calculate total completed spending for every customer?

Advancedโฑ 3 Minutesโญ 1980 XP
๐Ÿค” THE QUESTION

How can we calculate total completed spending for every customer?

๐Ÿ’ก WHAT IS IT?

Filtering completed orders and aggregating by customer_id measures Customer Lifetime Value (CLV).

๐ŸŽฏ WHAT IS IT USED FOR?

CLV reporting, marketing ROI attribution, customer cohort valuation.

๐Ÿ’ป EXAMPLE
SELECT
customer_id,
SUM(amount) AS lifetime_value
FROM orders
WHERE status = 'Completed'
GROUP BY customer_id;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for Customer Lifetime Value.

  • โœ“ Customer Lifetime Value
  • โœ“ Completed status filter
  • โœ“ Revenue summation
  • โœ“ Cohort metrics