Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL for Data Quality
00:00
5 left

SQL for Data Quality

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.

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

Your question is SQL for Data Quality. Start with the requirements and the three 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.