Back to Practice
#0384

Users With No Purchases After Signup

MediumSQL24 min20 XP

Problem

Return user_id values for users with no purchase on or after their signup_date.

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

users(user_id INTEGER, signup_date TEXT); purchases(user_id INTEGER, purchase_date TEXT)

Examples

Example 1
Inputuser 2 purchased before signup only; user 3 never purchased
Output2 and 3

The date condition belongs in the JOIN so unmatched users survive.

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
Inputuser 2 purchased before signup only; user 3 never purchased
Expected[[2],[3]]

The date condition belongs in the JOIN so unmatched users survive.

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