Download answer_key/kpis/attrition_rate.sql from misatadata/pepperwind: direct link, hf CLI and curl.
- Browser
- Download file 611 Bytes
-
https://huggingface.co/datasets/misatadata/pepperwind/resolve/main/answer_key/kpis/attrition_rate.sql
- Command line
-
hf download hf://datasets/misatadata/pepperwind/answer_key/kpis/attrition_rate.sql
-
curl -L -o attrition_rate.sql https://huggingface.co/datasets/misatadata/pepperwind/resolve/main/answer_key/kpis/attrition_rate.sql
611 Bytes
| -- Monthly attrition rate | |
| -- Employees employed at the month's start whose leaving day falls in it, over those employed at its start. | |
| WITH m AS (SELECT strftime(range, '%Y-%m') AS month, range AS t0, range + INTERVAL 1 MONTH AS t FROM range(TIMESTAMP '2023-10-01', TIMESTAMP '2026-10-01', INTERVAL 1 MONTH)) SELECT m.month, count(*) FILTER (WHERE e.leave_date < m.t) AS left_in_month, count(*) AS headcount_at_start, count(*) FILTER (WHERE e.leave_date < m.t)::DOUBLE / count(*) AS value FROM m JOIN core.employee e ON e.hire_date < m.t0 AND (e.leave_date IS NULL OR e.leave_date >= m.t0) GROUP BY 1 ORDER BY 1 | |