SQL Date Functions Practice — 36 Challenges (26 Free)

36 hands-on challenges counted from the live bank — 6 Easy, 20 Medium, 10 Hard — every one on the skill radar's Date Functions axis: cut a timestamp down to the month or the weekday you want to group by, measure a span in days between two dates, and filter to a window without silently dropping its last day. 26 are free to play; the Hard ones are Pro. Real datasets, AI tutoring.

Start Practicing Free →

SQLite is the dialect here, which is the useful case to learn: there is no DATE_TRUNC and no INTERVAL, so you do the work with strftime and julianday — and two of the public datasets store their dates as text, where SUBSTR is the only way in. Three challenges on the axis land in none of the three sections below: two put a date inside a window function and are listed on the window functions page, and one pins a year with LIKE.

Truncating a date — strftime and the part you group by: 17 challenges (14 free)

strftime('%Y-%m', order_date) is how you get a month out of a timestamp in SQLite, '%w' a weekday, '%Y' a year — and the string it returns is what you GROUP BY. Start with Monthly Order Count, then Spend by Day of Week. The two public-data ones — Pre-1900 Banks and Failed Banks Recent Decade — carry dates stored as text in a different layout, so the year comes out with SUBSTR instead; that is the real-world case, not a trick.

Counted from the challenge bank, September 2026. Easy first, then Medium, then Hard.

Easy Free

Monthly Order Count

Uses: GROUP BY Date Functions strftime

Try it →
Easy Free

January 2024 Orders

Uses: WHERE Date Functions strftime

Try it →
Easy Free

Pre-1900 Banks

Finance & Banking track · Uses: WHERE Date Functions ORDER BY

Try it →
Easy Free

Spend by Day of Week

Finance & Banking track · Uses: GROUP BY CASE Date Functions strftime

Try it →
Medium Free

Quarterly Hiring Cohort Report

Uses: Date Functions CASE GROUP BY Aggregation

Try it →
Medium Free

Monthly Order Trends

Uses: Date Functions GROUP BY Aggregation ORDER BY

Try it →
Medium Free

Monthly Order Volume in 2024

Uses: Date Functions strftime GROUP BY Aggregation

Try it →
Medium Free

Multi-Month Active Customers

Uses: JOIN GROUP BY HAVING COUNT DISTINCT

Try it →
Medium Free

Month-over-Month Customer Growth

Uses: GROUP BY Aggregation Window Functions LAG

Try it →
Medium Free

Same-Year Hires in Same Department (Self Join)

Uses: JOIN Self Join Date Functions

Try it →
Medium Free

Customer Signup Quarter (Date + CASE)

Uses: Date Functions strftime CASE

Try it →
Medium Free

Day-of-Week Order Pattern (strftime)

Uses: GROUP BY Date Functions strftime

Try it →
Medium Free

Failed Banks Recent Decade

Finance & Banking track · Uses: WHERE Date Functions Aggregation GROUP BY

Try it →
Medium Free

Failure Clustering — State + Year

Finance & Banking track · Uses: GROUP BY HAVING Date Functions

Try it →
Hard Pro

Month-over-Month Revenue Growth

Uses: Window Functions LAG Date Functions GROUP BY

Try it →
Hard Pro

Customer Retention Cohort

Uses: CTE MIN Date Functions GROUP BY

Try it →
Hard Pro

YoY Sales Volume Per Borough

Uses: Window Functions LAG Date Functions GROUP BY

Try it →

Date arithmetic with julianday — spans, age and latency: 14 challenges (7 free)

julianday(a) - julianday(b) is a number of days, fractions included, and everything else is division: / 365 for years of tenure, * 24 for hours between two swipes, * 86400 for seconds. Start with Date Functions: How Long Ago? and Tenure in Months (Date Math); the Hard ones use the same span as a rule — a session gap, a repeat purchase, a velocity check on a card.

Counted from the challenge bank, September 2026. Easy first, then Medium, then Hard.

Medium Free

Date Functions: How Long Ago?

Uses: Date Functions ORDER BY

Try it →
Medium Free

Employee Tenure Bands

Uses: Date Functions CASE CTE GROUP BY

Try it →
Medium Free

Customer Recency Analysis

Uses: JOIN GROUP BY Date Functions Aggregation

Try it →
Medium Free

Department Tenure Span

Uses: GROUP BY Aggregation Date Functions JULIANDAY

Try it →
Medium Free

Promotion Eligibility Matrix

Uses: CASE Date Functions AND Date Functions + CASE

Try it →
Medium Free

Tenure in Months (Date Math)

Uses: Date Functions julianday

Try it →
Medium Free

How Long Has Each Card Been Active?

Finance & Banking track · Uses: GROUP BY Aggregation Date Functions JULIANDAY

Try it →
Hard Pro

Customer Lifetime Value Pipeline

Uses: JOIN Subquery Window Functions NTILE

Try it →
Hard Pro

Order Sessionization by Customer

Uses: CTE Window Functions LAG CASE

Try it →
Hard Pro

Detect Repeat Buyers Within 7 Days

Uses: Self-Join Date Functions DISTINCT BETWEEN

Try it →
Hard Pro

Self-Join: Repeat Orders Within a Week

Uses: JOIN Date Functions Self-Join DISTINCT

Try it →
Hard Pro

Velocity Rule — 5+ Transactions in 5 Minutes

Finance & Banking track · Uses: JOIN GROUP BY Date Functions Self-Join

Try it →
Hard Pro

Geographic Mismatch — Impossible Travel

Finance & Banking track · Uses: Window Functions LAG Date Functions

Try it →
Hard Pro

Two Swipes at the Same Merchant Inside a Day

Finance & Banking track · Uses: Self-JOIN JOIN JULIANDAY Date Functions

Try it →

Date ranges — the half-open window: 4 challenges (2 free)

Write a window as d >= start AND d < end, not BETWEEN start AND end. Against a column that stores a time as well as a date, the closed upper bound matches only midnight and drops the whole last day — the bug that makes a weekly report quietly miss a Sunday. The Ledger's First Week, Day by Day is the half-open form written out; Dormant Cards is the open-ended one, and the two Hard ones put the window inside a join condition so a row is compared against its own neighbours in time.

Counted from the challenge bank, September 2026. Easy first, then Medium, then Hard.

Easy Free

The Ledger's First Week, Day by Day

Finance & Banking track · Uses: WHERE GROUP BY Date Functions AVG

Try it →
Medium Free

Dormant Cards — No Transactions in the Last 14 Days

Finance & Banking track · Uses: LEFT JOIN IS NULL CTE Date Functions

Try it →
Hard Pro

Detect Repeat Buyers Within 7 Days

Uses: Self-Join Date Functions DISTINCT BETWEEN

Try it →
Hard Pro

Velocity Rule — 5+ Transactions in 5 Minutes

Finance & Banking track · Uses: JOIN GROUP BY Date Functions Self-Join

Try it →

A date on its own is a small skill; it earns its keep next to the others. The monthly trend needs aggregation, the month-over-month change needs a window function, and the cohort table needs a CTE.