Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL Set Membership Query

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

Your question is SQL Set Membership Query. 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

Alegeus WealthCare administrators need to identify active Healthcare FSA accounts whose approved 2025 reimbursements exceed the account's annual contribution. Write a PostgreSQL query using the member, account, and claim data.

Requirements

  1. Include only active Healthcare FSA accounts.
  2. Include only claims with approved status submitted during calendar year 2025.
  3. Return the member, account type, total approved reimbursement, and approved claim count.
  4. Keep only accounts where total approved reimbursement is greater than the annual contribution, then sort by reimbursement descending.

Schema

members
ColumnTypeDescription
member_idPKINTUnique member identifier
member_nameVARCHAR(100)Member's full name
accounts
ColumnTypeDescription
account_idPKINTUnique benefit account identifier
member_idINTMember who owns the account
account_typeVARCHAR(40)Type of benefit account
statusVARCHAR(20)Current account status
annual_contributionNUMERIC(12,2)Annual contribution limit or election
claims
ColumnTypeDescription
claim_idPKINTUnique claim identifier
account_idINTAccount associated with the claim
statusVARCHAR(20)Claim processing status
submitted_atDATEDate the claim was submitted
reimbursement_amountNUMERIC(12,2)Amount reimbursed for the claim
Tablesmembersaccountsclaims
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results