HR Workforce Snapshot — Org Tree, Pay Equity, Attrition Risk, and Headcount
HR Workforce Snapshot — Org Tree, Pay Equity, Attrition Risk, and Headcount
This query is the SQL equivalent of an HR dashboard: it traverses the org chart to build reporting chains, detects compensation outliers, scores attrition risk, and compares actual headcount to budget. It is one of the most technically diverse queries in the course — combining recursive CTEs, window functions, statistical aggregates, and multi-factor scoring in a single pass.
Datasets used: hr_employees, hr_departments, hr_job_levels, hr_salaries, hr_performance_reviews, hr_headcount_snapshots