Explain the difference between a window function and a group by clause.
Use the provided sales data to demonstrate both approaches for department-level totals and row counts. Return the detail rows along with the equivalent department metrics calculated by each approach.
department, then sale_id.sale_id, department, employee_name, amount, department totals from both approaches, and department row counts from both approaches.| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique identifier for the sale |
| department | VARCHAR(50) | Department responsible for the sale |
| employee_name | VARCHAR(100) | Employee associated with the sale |
| amount | NUMERIC(10,2) | Sale amount |