Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Clean Merchant Transactions for Analysis

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

Your question is Clean Merchant Transactions for Analysis. Start with the requirements and the three 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

You need to clean inconsistent PSCU transaction records and produce a category-level summary. The dataset includes duplicate loads, inconsistent merchant text, mixed status labels, inactive members, and missing references. Return one row per merchant category with valid posted transaction count, distinct active member count, and total posted amount.

Schema

ColumnTypeDescription
member_id
member_name
member_status
ColumnTypeDescription
merchant_id
merchant_name
merchant_category
ColumnTypeDescription
txn_id
member_id
merchant_name_raw
txn_date
amount
txn_status
load_ts
Tablespscu_memberspscu_merchantspscu_transactions
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results