Skip to content

Practice Count Salary Categories

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#1907
LeetCode Problem

Count Salary Categories

Problem Statement

Tables: Accounts(account_id INT, income INT). Accounts.account_id is unique and income is monthly income. Return category and accounts_count for all three categories: Low Salary for income below 20000, Average Salary for income from 20000 through 50000 inclusive, and High Salary for income above 50000. Include a row with count 0 for an empty category. Output order is unrestricted.

Source: Count Salary Categories on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
Accounts table: +------------+--------+ | account_id | income | +------------+--------+ | 3          | 108939 | | 2          | 12747  | | 8          | 87709  | | 6          | 91796  | +------------+--------+
Output
+----------------+----------------+ | category       | accounts_count | +----------------+----------------+ | Low Salary     | 1              | | Average Salary | 0              | | High Salary    | 3              | +----------------+----------------+

Related LeetCode Problems

Practice more problems similar to Count Salary Categories.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.