SQL QuestSQL Interview Questions › Aggregation & Grouping

Department Performance Rate

MediumFreeQuerying BasicsAggregation & GroupingConditional Logic

Write a SQL query to calculate the percentage of high performers (rating >= 4.0) in each department. Return department and high_performer_rate (as percentage, rounded to 1 decimal). Order by high_performer_rate descending.

Solve it in the browser editor →

Runs on SQLite in your browser, graded against the expected result, no signup. A wrong answer gets a diagnosis, not just "incorrect".

Schema

employees

emp_idnamedepartmentpositionsalaryhire_datemanager_idperformance_rating
1Alice JohnsonEngineeringSenior Developer950002019-03-1554.5
2Bob SmithEngineeringDeveloper750002020-06-0113.8
3Carol WilliamsMarketingMarketing Manager850002018-09-20NULL4.2

Expected output: high_performer_rate: 70.0%

Hint

Use SUM(CASE WHEN performance_rating >= 4.0 THEN 1 ELSE 0 END) / COUNT(*) * 100

Concepts

SELECT GROUP BY Aggregation CASE Rate Calculation

Practise the topic: SQL practice questions · GROUP BY exercises · CASE WHEN practice

In these company practice sets

Snowflake

A SQL Quest challenge matched to patterns reported for these companies — not a question any of them has published.

Related questions

Class Survival BreakdownMedium · FreeDepartment Roster with GROUP_CONCATMedium · FreeMovie Rating Tier BreakdownMedium · FreeFull Survival Dashboard by ClassMedium · FreeGenre Financial ReportMedium · FreeDepartment Compensation ReportMedium · Free

Where would this cost you points in an interview?

Ten questions, no signup: a Skillmap across nine SQL skills and the one to fix first.

Take the readiness test