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
Start free
Find Merchant Alert Types with High False Positives
00:00
5 left

Find Merchant Alert Types with High False Positives

MediumSQL · PostgreSQL

Problem

How would you use SQL to investigate data issues like false positives?

Use the provided transaction, fraud alert, and merchant data. Focus on reviewed alerts with a resolved outcome and identify merchant and alert-type combinations where at least half of reviewed alerts were false positives.

Output

  1. One row per qualifying merchant and alert type.
  2. Include merchant_id, merchant_name, alert_type, reviewed_alerts, false_positive_count, and false_positive_rate_pct.
  3. Sort by false-positive rate descending, reviewed alert count descending, and merchant name ascending.

Output details

  • Treat resolved outcomes as exactly false_positive or confirmed_fraud.
  • Require at least 2 reviewed alerts per merchant and alert-type combination.
  • Round false_positive_rate_pct to 2 decimal places.

Schema

transactions
ColumnTypeDescription
transaction_idPKINTUnique transaction identifier
merchant_idINTMerchant associated with the transaction
transaction_dateDATEDate the transaction occurred
amountNUMERIC(12,2)Transaction amount
fraud_alerts
ColumnTypeDescription
alert_idPKINTUnique fraud alert identifier
transaction_idINTTransaction that generated the alert
alert_typeVARCHAR(50)Category of fraud alert
review_statusVARCHAR(30)Current review state of the alert
outcomeVARCHAR(30)Resolved alert classification
merchants
ColumnTypeDescription
merchant_idPKINTUnique merchant identifier
merchant_nameVARCHAR(120)Merchant display name
merchant_regionVARCHAR(50)Merchant operating region
Tablestransactionsfraud_alertsmerchants
Interviewer

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

Sign up free to run or submit. Log in
CodePostgreSQL
Sign up free to run your code. Your draft is saved.Run with a free accountLog inLn 1
Run your query to see results here.