Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Compare Card Spend Across Segments

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

Your question is Compare Card Spend Across Segments. 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

Write a PostgreSQL query that compares June 2024 cardmember performance across region and segment. Your result should show active cardmembers, total billed amount, average billed amount per active cardmember, and a label indicating whether each group is above or below the overall portfolio average. Only keep groups with at least 2 active cardmembers.

Schema

ColumnTypeDescription
customer_id
customer_name
region
segment
signup_date
ColumnTypeDescription
transaction_id
customer_id
transaction_date
billed_amount
merchant_category
Tablesamex_customersamex_transactions
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results