Repeat Purchase Rate
Return one row with customers (customers with at least one order), repeat_customers (those with two or more orders) and repeat_rate_percent (the share of repeat customers, rounded to 1 decimal).
Hint 1
Count orders per customer in a derived table first.
Reference solution
SELECT COUNT(*) AS customers,
SUM(CASE WHEN orders >= 2 THEN 1 ELSE 0 END) AS repeat_customers,
ROUND(100.0 * SUM(CASE WHEN orders >= 2 THEN 1 ELSE 0 END) / COUNT(*), 1) AS repeat_rate_percent
FROM (SELECT customer_id, COUNT(*) AS orders FROM orders GROUP BY customer_id) AS per_customer;
The denominator is part of the definition: "repeat rate among buyers" and "repeat rate among all customers" are different KPIs. Agree on the definition before you write the query. A KPI query is usually a derived table (one row per entity) with a single aggregate over it; keeping those two layers separate makes the logic easy to audit.