Best April deals - hours only!Up to 80% off on all courses and bundles.-Close
Conversion rates
4. Global lifetime conversion rate – step 2
Time to first order
Conversion charts


Great! Now that we know how to find the count of all customers and the count of those who've made a purchase, we can calculate the global lifetime conversion rate:

SELECT ROUND(COUNT(FirstOrderId) / CAST(COUNT(*) AS FLOAT), 2) AS ConversionRate
FROM Customers;

We simply divided the number of made-a-purchase customers by the total number of registered customers. Notice that we cast the denominator to a FLOAT type using CAST(COUNT(*) AS FLOAT). Both the numerator and the denominator are integers, so SQL Server would use integer division by default. The result would be incorrect, so we had to cast one of the values to force float division.

We also used the ROUND(value, number) function, which rounds the given value to the given number of decimal places.


Find the lifetime conversion rate among customers who registered in 2017. Show the result in a column named ConversionRate. Round the result to four decimal places.

Stuck? Here's a hint!

You need a WHERE clause with the RegistrationDate column.