Earlier data work
Apple global sales: end-to-end SQL
Transactions Jan 2022 – Dec 2024 · Built Dec 2025
Not a single ad-hoc query, but a repeatable database story on 11,500 rows and 27 columns spanning regions, channels, discounts, returns and customer segments (Kaggle-based Apple global sales dataset).
What’s in the repo
- Schema and load:
CREATE TABLEwith sensible types and constraints, thenLOAD DATA. - Cleaning passes:
UPDATE,TRIM,NULLIF. - 30 business questions grouped by theme: sales performance, geography, product mix, customer behaviour, returns and ratings, and window logic (rolling revenue, ranked products per region, running totals by channel).
- Reusable views: monthly revenue, category KPIs, regional summary, customer scorecard, channel performance.
- Five stored procedures parameterised by year, category, date range, region and channel.
The numbered SQL files (05_business_q1_q5.sql … 10_business_q26_q30.sql) can be followed in order.