Problem · Database
Employees Joined per Month
Problem statement
An employees table contains one row per employee:
employee_id: the employee's unique integer identifier.joining_date: the employee's joining date.
For this exercise, assume all joining_date values in one testcase belong to the same calendar year.
Return one row for each calendar month represented in the table. Each row must contain:
month_name: the English name of the month.employee_count: the number of employees who joined in that month.
Do not return months with no employees. If the input table is empty, return an empty result. Sort the rows by calendar month from January through December.
Table schema
MySQLPostgreSQLPandas
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
employees
One row per employee.
| Column | Type | Nullable | Description |
|---|---|---|---|
| employee_idPK | Integer | No | The employee's unique identifier. |
| joining_date | Date | No | The date on which the employee joined. |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| month_name | Text | No | — |
| employee_count | Integer | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
employee_idis unique and non-null.joining_dateis a valid, non-null date.- All joining dates in one testcase are from the same calendar year.
- The result columns must be named
month_nameandemployee_count.