Beginner

115. Extract Month

Learn how to extract the month component from a date.

📘 Lesson 115 of 728 ⏱ 7 min 🎯 Beginner

Extracting the month means retrieving the month component from a date or timestamp. The result is commonly represented as a number from 1 through 12.

Monthly analysis is fundamental to sales reporting, financial reporting, operational monitoring, and trend analysis.

An analyst can extract the month from OrderDate and calculate monthly sales totals.

SQL
SELECT
    EXTRACT(MONTH FROM OrderDate) AS OrderMonth,
    SUM(SalesAmount) AS TotalSales
FROM Sales
GROUP BY EXTRACT(MONTH FROM OrderDate);

Month extraction is useful for monthly revenue analysis, seasonal trends, customer activity, and operational reporting.

  • Month can be extracted from dates.
  • Months are commonly represented from 1 to 12.
  • Monthly grouping is common in reporting.
  • Month extraction supports trend analysis.
  • Database syntax can vary.
How can you extract a month from a date?

Use EXTRACT(MONTH FROM date) or an equivalent database-specific function.

Why is month extraction useful?

It allows analysts to group and compare business activity by month.

Have you finished this lesson?

Introduction to SQL – All Lessons