Back to Practice
#0373

Find Missing Dates From Calendar

MediumSQL24 min20 XP

Problem

Return calendar days that have no matching sales row.

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

calendar(day TEXT); sales(day TEXT, revenue INTEGER)

Examples

Example 1
Inputsales are missing Jan 2
Output2026-01-02

The calendar table supplies dates that may be absent from sales.

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
Inputsales are missing Jan 2
Expected[["2026-01-02"]]

The calendar table supplies dates that may be absent from sales.

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