Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
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
Experiences
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
Build my plan
SQL and Python Generators
00:00
5 left

SQL and Python Generators

MediumSQL · PostgreSQL

Problem

Tell me about your experience with SQL and Python, including generators and sequences.

For this exercise, use the provided event tables to identify users who have at least one completed transfer and at least one failed transfer. Keep the answer focused on the data result, not on implementation details.

Output

  1. One row per user who has both a completed and failed transfer
  2. Columns: user_id, user_name, completed_transfers, failed_transfers
  3. Sort by failed_transfers descending, then user_id ascending

Schema

users
ColumnTypeDescription
user_idPKINTUnique user identifier
user_nameVARCHAR(100)User display name
country_codeVARCHAR(2)Two-letter country code
transfers
ColumnTypeDescription
transfer_idPKINTUnique transfer identifier
user_idINTUser who initiated the transfer
statusVARCHAR(20)Transfer outcome, such as completed or failed
amountNUMERIC(12,2)Transfer amount
created_atTIMESTAMPTransfer creation timestamp
Tablesuserstransfers
Interviewer

Your question is SQL and Python Generators. Start with the requirements and the two tables in the Question tab.

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.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.