SQL interview questions · By company
JPMorgan Chase SQL interview questions
For data analyst and risk analytics roles: what candidates report, and how to practice for it.
SQLRep isn't affiliated with or endorsed by JPMorgan Chase. This guide summarizes public candidate reports and prep guides (sources below, checked November 2026). The practice questions are original, written in the reported style; they aren't JPMorgan Chase's actual questions. Processes change, so confirm details with your recruiter.
What candidates report about the process
- Prep guides list SQL alongside Python and Excel for analyst roles.
- Risk analytics interviews are reported to pair SQL scenarios with risk-management case studies.
SQL topics that come up
- Window functions over transactions: rolling sums and running balances
- Cleaning and matching text, such as merchant names
- Spotting risky patterns in account activity
Practice the reported patterns
Each one runs in real PostgreSQL in your browser, with feedback on what's wrong.
- Days over a rolling 7-day spending limitFor each account and each date with at least one debit, rolling_7d_spend is the total debited from 6 days before that date through that date. Return account_id, debit_date, rolling_7d_spend and weekly_limit for the days where rolling_7d_spend is greater than weekly_limit, one row per account and date. Sort by account_id, then debit_date.Pattern: RANGE window with INTERVAL · daily pre-aggregationHardPro
- Clean merchant names, then rank by spendClean each raw_merchant: remove every '#' with the digits after it, collapse runs of spaces to one space, trim both ends and upper-case it. Return merchant (the cleaned name), txn_count, total_spend and spend_rank (RANK by total_spend, highest first; tied merchants share a rank and the next rank is skipped). Sort by spend_rank, then merchant.Pattern: REGEXP_REPLACE · TRIM · UPPER · RANKMediumPro
- Three declines within 24 hoursReturn account_id and flagged_at: the earliest declined attempt at which the account had 3 or more declines in the 24 hours up to and including that moment. One row per flagged account. Sort by account_id.Pattern: Rolling COUNT over a time RANGE · first match per groupHardPro
- Same card, two cities, one hourFind every pair of authorizations in fin_card_auths on the same card where the second one was in a different city, after the first and at most 60 minutes later (exactly 60 counts). Approved and declined attempts both count. Return card_id, first_city, first_at, second_city and second_at. Sort by card_id, first_at, second_at.Pattern: Self-join on a time windowHardPro
- Running revenue totalFor completed orders, return order_date, amount and running_total (cumulative sum of amount by order_date, rounded to 2 decimals), oldest first.Pattern: SUM() OVER · running totalsMediumPro
- 7-day moving average revenueTotal completed order amounts per order_date. Then, for each order_date from 2024-07-07 onward, return day, revenue (that day's completed total) and moving_avg_7d (completed revenue over the 7 calendar days ending that day, divided by 7, rounded to 2 decimals). Oldest first.Pattern: RANGE window frame · calendar moving averageHardPro
- Parse a text-only importReturn id, vendor (with leading and trailing spaces trimmed), amount (amount_text as numeric, with $, commas and spaces removed; 'N/A', empty or spaces-only becomes NULL) and invoice_date (invoice_date_text as a date; empty or spaces-only becomes NULL) for every row of invoice_import_raw. Sort by id.Pattern: TRIM · NULLIF · regexp_replace · ::numeric · ::dateMediumPro
- Balance down three months in a rowIn fin_monthly_balances, a month is a decline when its balance is lower than the same account's previous month-end (equal is not a decline). Return account_id, alert_month (the month_end) and balance for every month that completes at least three declines in a row, meaning that month and the two before it were all declines. Sort by account_id, alert_month.Pattern: LAG with offsets · consecutive declinesHardPro
- Reconcile the books with the bankMatch fin_book_entries to fin_bank_lines on ref and return only the breaks: ref, book_amount, bank_amount and status, where status is 'missing_in_bank' (only in the books), 'missing_in_books' (only on the bank statement) or 'amount_mismatch' (on both, with different amounts). Leave out refs whose amounts match, whatever their dates. Sort by ref.Pattern: FULL OUTER JOIN · IS DISTINCT FROM · CASEHardPro
Tip: Banking data is messy and regulated: mention how you'd validate a number before anyone acts on it.
Sources
JPMorgan Chase is a trademark of its owner, used here only to identify the company the reports are about.