SQL Data Analytics • Lesson 11
Date & Time Analysis
Learn how analysts extract years, months and days from dates and use them to understand monthly and yearly business trends.
0 of 8 concepts completed
Complete the activity and related MCQ to unlock the next concept.
Why Dates Matter in Analytics
A date column looks simple, but it contains year, month and day information. Analysts extract those parts to study monthly sales, yearly trends, seasonality and customer behavior.
Interactive Data
Orders table
Six orders across January through April 2026 — enough to see monthly, seasonal and daily patterns.
| order_id | customer | order_date | year | month | day | amount |
|---|---|---|---|---|---|---|
| 1001 | Rahul | 2026-01-15 | 2026 | January | 15 | ₹25,000 |
| 1002 | Priya | 2026-02-10 | 2026 | February | 10 | ₹18,000 |
| 1003 | Amit | 2026-02-28 | 2026 | February | 28 | ₹32,000 |
| 1004 | Neha | 2026-03-12 | 2026 | March | 12 | ₹15,000 |
| 1005 | Arjun | 2026-03-25 | 2026 | March | 25 | ₹42,000 |
| 1006 | Kavya | 2026-04-08 | 2026 | April | 8 | ₹21,000 |
Learn by Seeing
One date, three components
2026-03-25 │ ├── Year → 2026 ├── Month → 3 └── Day → 25
Every date can be broken into a year, a month and a day — each useful for a different analysis.
Pick a date — see how it splits:
Year
2026
Month
March
Day
25
Interactive Activity
What can be extracted from a single date?
Hint: Think about the three parts of a date value.
SQL Analyst Mindset
Every business question is a time question
Revenue, retention, seasonality and customer behavior are all time-based. Learning to extract date parts is what makes trend analysis possible.
Extract
Year, month or day from the date.
Group
Combine rows into periods.
Aggregate
Sum, count or average per period.
Compare
Identify growth or decline.
Frequently Asked Questions
SQL Date & Time Analysis — FAQs
A full date is too granular for trend analysis. Extracting the month lets GROUP BY combine many days into one period.
A filter like date >= '2026-03-01' and date < '2026-04-01' — it includes the start but excludes the end, avoiding time-of-day edge cases.
Yes. PostgreSQL, MySQL and SQL Server offer similar concepts but with different syntax (EXTRACT, YEAR(), MONTH(), etc.).
Without it, months can appear in arbitrary order. ORDER BY keeps the report chronological and readable.
Lesson Summary
What you learned
Year, month and day can be extracted separately.
Pull out a date part in supported SQL dialects.
Build monthly and yearly reports.
Use WHERE with a half-open range to select a period.