Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Find Unapplied Cash Payments

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

Your question is Find Unapplied Cash Payments. 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

Task

You are given payment activity and account master data. Write a PostgreSQL query that returns all unapplied cash payments — payments that were received but were not matched to an account — along with the payment details needed for reconciliation. Include payments with a missing account_id as well as payments whose account_id does not exist in the accounts table.

Schema

payments
ColumnTypeDescription
payment_idPKINTPrimary key for each payment
account_idINTReferenced account identifier, may be missing for unapplied cash
payment_dateDATEDate the payment was received
payment_amountDECIMAL(12,2)Payment amount
payment_methodVARCHAR(50)Method used for the payment
accounts
ColumnTypeDescription
account_idPKINTPrimary key for each account
account_nameVARCHAR(100)Account name
statusVARCHAR(20)Account status
Tablespaymentsaccounts
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results