SQL Query to Make Month Wise Report - GeeksforGeeks

SQL Query to Make Month Wise Report

Last Updated : 29 Oct, 2026

A month-wise report in SQL displays data grouped by month. It helps count the number of employees who joined in each month, making it easier to understand monthly joining records.

  • Shows the number of employees hired each month.
  • Makes it easy to compare monthly joining records.

First, we will create an employees table with the columns employee_name, phone_number, joining_date and designation and insert sample employee records to create a month-wise report.

sql_month_wise_report1

Example 1 : Month-Wise Report Using Month Numbers

The EXTRACT() function retrieves the month number from each joining date, while COUNT(*) counts the employees who joined in each month.

Query:

SELECT
EXTRACT(MONTH FROM joining_date) AS month,
COUNT(*) AS total_employees
FROM employees
GROUP BY EXTRACT(MONTH FROM joining_date)
ORDER BY month;

Output:

sql_month_wise_report3

Example 2: Month-Wise Report Using Month Names

To display month names instead of numbers, use the TO_CHAR() function. It converts the joining date into the full month name.

Query:

SELECT
EXTRACT(MONTH FROM joining_date) AS month_number,
TO_CHAR(joining_date, 'Month') AS month_name,
COUNT(*) AS total_employees
FROM employees
GROUP BY
EXTRACT(MONTH FROM joining_date),
TO_CHAR(joining_date, 'Month')
ORDER BY month_number;

Output:

sql_month_wise_report2


Comment