How would you compute a ratio-to-report or share-of-total metric using aggregate window functions?
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: medium
Interview Round: Other
Overview: Explain how to compute a share-of-total or ratio-to-report metric in SQL with aggregate window functions, both against the grand total and within groups. Tests use of SUM OVER with PARTITION BY, safe division, and how grouping, filters and window ordering change the denominator.