Retail sales reporting in SQL
Monthly sales report for a retail chain, written entirely in PostgreSQL: revenue by store and category, basket size, and the share of revenue from the top 20% of products. Found that two stores had been double-counting returned items for six months.