Beginner

273. YEAR Function

Learn how to extract the year from a date.

📘 Lesson 273 of 728 ⏱ 8 min 🎯 Beginner

The YEAR function returns the year component from a date value.

Year extraction is important for annual reporting, year-over-year comparisons, financial analysis, and long-term trend analysis.

Extract the year from customer registration dates.

SQL
SELECT
    CustomerID,
    YEAR(RegistrationDate) AS RegistrationYear
FROM Customers;

YEAR is commonly used in annual sales reports, financial statements, employee analysis, and year-over-year business comparisons.

  • YEAR extracts the year component.
  • It is useful for annual analysis.
  • It can be used in filtering.
  • It can be used with GROUP BY.
  • Syntax varies between database platforms.
What does YEAR do?

YEAR returns the year component from a date.

How is YEAR used in business reporting?

YEAR allows records to be grouped and compared across different years.

Have you finished this lesson?

Introduction to SQL – All Lessons