Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

January Purchasers vs February

EasySQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is January Purchasers vs February. Start with the requirements and the two tables on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Monee wants to identify users who purchased through the Monee app during January 2025 but made no purchase during February 2025. Write a PostgreSQL query that returns these January-only purchasers.

Requirements

  1. Treat any purchase from 2025-01-01 through 2025-01-31 as a January purchase.
  2. Exclude users with at least one purchase from 2025-02-01 through 2025-02-28.
  3. Return each qualifying user once, ordered by user_id ascending.

Schema

users
ColumnTypeDescription
user_idPKINTEGERUnique Monee user identifier
full_nameVARCHAR(100)User display name
signup_dateDATEDate the user registered
purchases
ColumnTypeDescription
purchase_idPKINTEGERUnique purchase identifier
user_idINTEGERUser who made the purchase
purchase_dateDATEDate of the purchase
amountNUMERIC(10,2)Purchase amount
Tablesuserspurchases
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results