Good job! Let's say we want to calculate the global lifetime conversion rate. In other words, we want to know the percentage of registered customers who've made at least one purchase. This is a good indicator of the general condition of our business.
To calculate the rate, we first need to find the total number of customers and the number of customers who've made at least one purchase. That's quite straightforward:
COUNT(first_order_id) AS customers_with_purchase,
COUNT(*) AS all_customers
COUNT(*) counts all rows in a table (in this case, all the customers), while
COUNT(column) only counts non-
NULL values in the specified column. Customers who didn't make any purchases have
first_order_id values, so they won't be added to the