Back to Practice
#0363

First Date Cumulative Revenue Crosses Threshold

HardSQL35 min25 XP

Problem

Return the first day where cumulative revenue is at least 100.

Why This Matters

SQL interviews usually test whether you can turn a business question into the right rows, grouping level, join type, and edge-case behavior.

Schema

daily_sales(day TEXT, revenue INTEGER)

Examples

Example 1
Inputrunning totals 30, 70, 120
Output2026-01-03

The threshold is first reached on Jan 3.

Constraints

  • Return only the requested columns.
  • Use deterministic ORDER BY when multiple rows are returned.
  • Assume SQLite-compatible SQL unless the prompt states otherwise.
CodeSQL
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core SQL case
Inputrunning totals 30, 70, 120
Expected[["2026-01-03",120]]

The threshold is first reached on Jan 3.

Hidden Test Categories
Empty or missing matchesDuplicate rows or tiesNULL values where the pattern commonly breaks