Skip to content
RED SAGSkills
medium10 pts · first answer countssqlaggregation

Share of paid orders in one query

Order statuses are: paid, paid, refunded, paid, cancelled. What does this query return?

SELECT AVG(CASE WHEN status = 'paid' THEN 1.0 ELSE 0 END) AS paid_rate
FROM orders;
Choose one answer