Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Get started
Find 2025 Cardholders Meeting Transaction Thresholds
00:00
5 left

Find 2025 Cardholders Meeting Transaction Thresholds

MediumSQL · PostgreSQL

Problem

Core Java, Spring framework, Microservices, SQL. For the SQL portion, use the provided cardholders and transactions tables to identify qualifying cardholders for calendar year 2025. Include only approved transactions when calculating totals and counts.

Output

  1. One row per qualifying cardholder.
  2. Columns: cardholder_id, cardholder_name, approved_transaction_count, and approved_total.
  3. Include cardholders with at least two approved transactions and an approved total of at least 1000.
  4. Order by approved_total descending, then cardholder_id ascending.

Schema

cardholders
ColumnTypeDescription
cardholder_idPKINTUnique cardholder identifier
cardholder_nameVARCHAR(100)Cardholder display name
regionVARCHAR(50)Cardholder billing region
transactions
ColumnTypeDescription
transaction_idPKINTUnique transaction identifier
cardholder_idINTCardholder associated with the transaction
transaction_dateDATETransaction processing date
statusVARCHAR(20)Transaction processing status
amountDECIMAL(12,2)Transaction amount
Tablescardholderstransactions
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the two tables are in the Question tab.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.