Ad Accounts Sharing a Payment Method With a Banned Account

Last updated: November 29, 2026

Quick Overview

Find active Meta ad accounts that share any payment instrument fingerprint with an account banned for policy violations in the last 90 days, and return each risky account once with the number of banned accounts it is linked to.

Meta
Data Manipulation (SQL/Python)
Data Scientist
Meta
November 29, 2026
Data Scientist
Onsite
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Find active Meta ad accounts that share any payment instrument fingerprint with an account banned for policy violations in the last 90 days, and return each risky account once with the number of banned accounts it is linked to.

Ads integrity at Meta links bad actors who come back on new accounts with the same card. The interviewer checks a bridge-table join, excluding the banned account itself, and deduping when accounts share several instruments.

What the Interviewer Expects
  • Joins accounts to payment instruments through a bridge table
  • Self joins the bridge on fingerprint to reach other accounts
  • Excludes matching an account to itself
  • Uses COUNT(DISTINCT banned_account) so multiple shared cards do not inflate
  • Restricts to currently active accounts and recent bans
Key Topics to Cover
bridge tables
self join
COUNT DISTINCT
integrity
entity linking
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you extend this to two hops (shared card, then shared device)?
  • How do you avoid flagging accounts that share a corporate card legitimately?
  • How would you turn the count into a risk score?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

ad_accounts(account_id, status, banned_at, ban_reason), account_payment(account_id, fingerprint), a many-to-many bridge since an account can have several cards and a card can be on several account...

Approach
  1. Banned set: accounts banned for policy in the last 90 days.
  2. Join banned accounts to their fingerprints, then join the bridge again on fingerprint to find other accounts with the same card.
  3. Ke...

Submit Your Answer
Markdown supported