Problem · Database

Employees Joined per Month

MediumOdoo logoOdooFULLTIMEOA

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.

ColumnTypeNullableDescription
employee_idPKIntegerNoThe employee's unique identifier.
joining_dateDateNoThe date on which the employee joined.

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
month_nameTextNo
employee_countIntegerNo

Row order: must match exactly. Numeric tolerance: 0.

Constraints

  • employee_id is unique and non-null.
  • joining_date is a valid, non-null date.
  • All joining dates in one testcase are from the same calendar year.
  • The result columns must be named month_name and employee_count.

More Odoo problems