Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
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
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
Using SQL to Find Inefficiencies
00:00
5 left

Using SQL to Find Inefficiencies

MediumSQL · PostgreSQL

Problem

Describe a time you used SQL to identify an inefficiency in a data set.

Use the provided tables to identify repeated settled execution records sharing the same account, instrument, timestamp, quantity, and price. Treat records with a missing or unmatched instrument reference as identifiable records rather than excluding them.

Output

  1. One row per repeated execution group
  2. Columns: account_id, instrument_symbol, executed_at, quantity, price, duplicate_count, excess_rows, total_quantity
  3. Include only groups with more than one record, ordered by excess_rows descending, then account and timestamp ascending

Schema

executions
ColumnTypeDescription
execution_idPKINTUnique execution record identifier
account_idVARCHAR(20)Trading account identifier
instrument_idINTReferenced instrument identifier
executed_atTIMESTAMPExecution timestamp
quantityINTExecuted quantity
priceNUMERIC(12,2)Execution price
statusVARCHAR(20)Execution processing status
instruments
ColumnTypeDescription
instrument_idPKINTUnique instrument identifier
symbolVARCHAR(20)Instrument symbol
asset_classVARCHAR(30)Instrument asset class
Tablesexecutionsinstruments
Interviewer

Your question is Using SQL to Find Inefficiencies. 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.