Describe your approach to writing a SQL query using window functions and Common Table Expressions to derive ranked performance metrics.
Use employees and performance_scores for the 2025-Q1 reporting period. Treat missing scores as zero for total-score ranking and exclude employees without a 2025-Q1 performance record.
employee_name, department, review_count, total_score, average_score, and department_rank.| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee display name |
| department | VARCHAR(80) | Employee department |
| Column | Type | Description |
|---|---|---|
| score_idPK | INT | Unique performance score identifier |
| employee_id | INT | Referenced employee |
| review_period | VARCHAR(20) | Reporting period for the score |
| score | DECIMAL(6,2) | Performance score for one review metric |