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
Identify SQL Metrics and Excluded Groups
00:00
5 left

Identify SQL Metrics and Excluded Groups

MediumSQL · PostgreSQL

Problem

You’re given an SQL query. Explain what problem the query is trying to solve.

Explain the query's purpose, filtering logic, aggregation level, calculated metric, and the reason for excluding some result groups.

Output

  1. State the business question answered by the query and describe the result columns and ordering.

Output details

  • Return transfer_month, recipient_country, total_transfers, completed_transfers, and completion_rate_pct in that order.
  • Aggregate results by calendar month and recipient country.
  • Limit created_at to >= DATE '2025-01-01' and < DATE '2025-04-01'.
  • Calculate completion_rate_pct as completed transfers divided by total transfers, multiplied by 100 and rounded to two decimal places.
  • Exclude groups with fewer than 2 total transfers.
  • Order by transfer_month ascending, then recipient_country ascending, placing NULL countries last.

Schema

transfers
ColumnTypeDescription
transfer_idPKINTUnique transfer identifier
recipient_account_idINTRecipient account identifier
created_atTIMESTAMPTransfer creation timestamp
statusVARCHAR(20)Current transfer status
accounts
ColumnTypeDescription
account_idPKINTUnique recipient account identifier
country_codeVARCHAR(2)Recipient account country code
Tablestransfersaccounts
Interviewer

Your question is Identify SQL Metrics and Excluded Groups. 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.