
SQL
A histogram in SQL: from orders to a customer distribution
The average customer places a few orders. But how many buy once, and how many return regularly? I build the distribution step by step, including the mistakes that make valid SQL answer the wrong question.