0
← Exercises/
Business Analytics•8 of 14
Business AnalyticsAdvancedPRO

Departmental Employee Tenure & Resignation Rates

Scenario

People analytics benchmarks department retention by measuring employee turnover rate (resigned staff divided by total headcount ever hired in that department).

Task
Group employees in `workforce_records` by `department`. Calculate: 1. `department` 2. `total_hires`: Total employee records in that department 3. `resigned_count`: Count of employees with `status = 'resigned'` 4. `turnover_rate_pct`: `ROUND(100.0 * COUNT(*) FILTER (WHERE status = 'resigned') / COUNT(*), 1)` Order results by `turnover_rate_pct` descending, then by `department` ascending.
Expected Output Format

Departmental turnover rates and resignation counts.

Input Tables & Sample Data0 tables
Loading database schema...
Need a hint?
query.sql|Local Sandbox
Loading SQL editor...
Click "Run" or press ⌘ + Enter to execute your query

About the “Departmental Employee Tenure & Resignation Rates” SQL Problem

Business Scenario

People analytics benchmarks department retention by measuring employee turnover rate (resigned staff divided by total headcount ever hired in that department).

Expected Output & Criteria

Departmental turnover rates and resignation counts.

Database Table Schema (PostgreSQL DDL)

PostgreSQL 16 WASM

This challenge executes directly against the following relational schema in your browser:

CREATE TABLE workforce_records (
        emp_id INT PRIMARY KEY,
        department VARCHAR(50) NOT NULL,
        status VARCHAR(20) NOT NULL
      );

Target SQL Clauses & Operators

GROUP BYCOUNTROUND

Want more Business Analytics practice?

Explore the full syllabus of 14 exercises, syntax guides, and interview pitfalls.

View Business Analytics Track→