Database · Medium
Show each department's salary cost as a percentage of the company total.
DatabaseSQL QueriesSeniorWindow Functions
Answer preview
Aggregate per department, then divide by the grand total obtained with a window function over the aggregate: SUM(SUM(salary)) OVER ().…