Extract February Payment Events
Find completed payment events that occurred during February 2025.
- Filtering
- Sorting
Exercise brief
Understand the request
Payments operations analyst The monthly reconciliation needs completed payment events from February 2025 only.
Return completed payment events that occurred during February 2025.
Return
- Return event_id, account_id, occurred_at in this exact left-to-right order.
Constraints
- Use a half-open month: include February 1 at midnight and exclude March 1 at midnight.
Data you will use
Review the relevant tables before deciding how to join, filter, or aggregate them.
filter_events
event_idINTEGERaccount_idINTEGERoccurred_atDATETIME
Hints, when you need them
Open one clue at a time so you still do the reasoning.
Hint 1
Represent a whole month as a half-open interval: include its first instant and exclude the first instant of the next month.
Hint 2
Filter event type and status, then apply `>=` to the February boundary and `<` to the March boundary.
Hint 3
SELECT event_id, account_id, occurred_at FROM filter_events WHERE event_type = /* event type */ AND status = /* final status */ AND occurred_at /* inclusive start */ '2025-02-01 00:00:00' AND occurred_at /* exclusive end */ '2025-03-01 00:00:00' ORDER BY occurred_at;
Verified SQL answer
Attempt the problem first, then compare structure and reasoning—not just syntax.
Reveal solution and explanation
SELECT event_id, account_id, occurred_at FROM filter_events WHERE event_type = 'payment' AND status = 'completed' AND occurred_at >= '2025-02-01 00:00:00' AND occurred_at < '2025-03-01 00:00:00' ORDER BY occurred_at;Why this works
The half-open interval includes midnight on February 1 and every later February timestamp, but excludes exactly midnight on March 1. The fixture contains rows immediately before, at, and after those boundaries, plus wrong-type and failed events. ISO timestamp literals work in the executable engines; Oracle uses explicit TIMESTAMP literals.
Success check
Only completed payment events inside the February interval are returned in timestamp order.
Expected result
Use this output to verify values, aliases, ordering, and row count.
| event_id | account_id | occurred_at |
|---|---|---|
| 2 | 101 | 2025-02-01 00:00:00 |
| 11 | 110 | 2025-02-13 23:59:59 |
| 3 | 102 | 2025-02-14 00:00:00 |
| 4 | 103 | 2025-02-14 12:30:00 |
| 5 | 104 | 2025-02-14 23:59:59 |
| 10 | 109 | 2025-02-15 00:00:00 |
| 6 | 105 | 2025-02-28 23:59:59 |
Learn the concepts behind this answer
Strengthen your understanding with these targeted learning topics:
Continue practicing
Build the next SQL skill
SELECT Statements
Select columns, filter rows, remove duplicates, and order query results.
CASE Statements & Conditional Logic
Build NULL-aware classifications, precedence-safe decisions, flags, scores, and guarded calculations with portable CASE expressions.
Date Operations & Time-Based Analytics
Practice date arithmetic, safe timestamp ranges, calendar bucketing, dense time series, rolling windows, growth, and cohort analysis.
Open the interactive workspace and practice across SQL topics.