Beginner

281. FIRST_DAY Function

Learn how to identify the first calendar day of a month.

📘 Lesson 281 of 728 ⏱ 9 min 🎯 Intermediate

The FIRST_DAY concept returns the first calendar day of the month containing a specified date. The exact function or expression varies between database systems.

Month-start dates are useful for financial reporting, monthly comparisons, billing cycles, and period-based analysis.

Find the first day of the month for each transaction date.

SQL
SELECT
    OrderDate,
    DATE_TRUNC('month', OrderDate) AS MonthStart
FROM Orders;

FIRST_DAY logic is useful for monthly reporting, financial periods, billing, and dashboard calculations.

  • FIRST_DAY identifies the beginning of a month.
  • The exact function varies by database.
  • It is useful for monthly grouping.
  • It supports period-based calculations.
  • It is commonly implemented using date truncation.
What does FIRST_DAY represent?

It represents the first calendar day of the month containing a specified date.

Why is the first day of a month useful?

It provides a consistent starting point for monthly reporting and date-range calculations.

Have you finished this lesson?

Introduction to SQL – All Lessons