Tackle the most demanding analytical SQL problems asked in Staff Analyst and Senior Data Engineering interviews. Parse nested JSONB audit telemetry, build monthly user retention matrices, and detect AML smurfing patterns.
Key patterns and rules practiced in this track.
The -> operator extracts a JSON object or array, while ->> extracts the value as text. The #>> operator traverses deeply nested JSON paths.
payload->>'key' OR payload#>>'{nested,path}'SELECT log_id, payload->>'event_name' AS event, (payload#>>'{metadata,duration_ms}')::INT AS duration FROM audit_logs WHERE payload->>'status' = 'error';Groups users by their acquisition month and tracks their activity across subsequent months (M0, M1, M2...) to build a retention heatmap.
DATE_TRUNC('month', signup_date) AS cohort_monthWITH cohorts AS (SELECT user_id, DATE_TRUNC('month', created_at) AS cohort_month FROM users), activity AS (SELECT user_id, DATE_TRUNC('month', event_time) AS active_month FROM events) SELECT c.cohort_month, a.active_month, COUNT(DISTINCT a.user_id) FROM cohorts c JOIN activity a ON c.user_id = a.user_id GROUP BY 1, 2 ORDER BY 1, 2;Quantifies customer loyalty by scoring how recently they purchased, how frequently they buy, and their total monetary spend into quartiles.
NTILE(4) OVER (ORDER BY metric) AS scoreSELECT customer_id, NTILE(4) OVER (ORDER BY MAX(order_date)) AS r_score, NTILE(4) OVER (ORDER BY COUNT(*)) AS f_score, NTILE(4) OVER (ORDER BY SUM(total)) AS m_score FROM orders GROUP BY customer_id;
Click any problem to open the interactive editor.
Extracted telemetry metrics with log_id, feature_name, duration_ms, and status for vector_search_v2 successes.
Cohort table displaying cohort_month, activity_month, and active_users.
Flagged wire transfers matching sanctioned names on official watchlists.
Extracted service error metrics for all fatal incidents.
Customer profiles with Recency, Frequency, and Monetary metrics.
Conversion funnel counts and admission rate percentage from the emergency department.
Vehicles overdue for preventative maintenance sorted by overdue miles.
Departmental turnover rates and resignation counts.
Executable arbitrage pairs where Exchange A bid exceeds Exchange B ask.
Single row summary showing DAU, MAU, and stickiness percentage.
Purchase funnel step counts and overall conversion percentage.
Summary of pathogen isolates and susceptibility percentage.
Geographic dispatch zones with calculated surge pricing multipliers.
Suspected smurfing bank accounts with 2 or more sub-$10k deposits.
Run queries directly in your browser against realistic tables.