Skip to content

Module 6: FAANG / Big Tech Interview Masterclass ​

IMPORTANT

This module contains 15 real-world SQL interview problems commonly asked at top tech companies. Each problem is self-contained with schema, sample data, brute-force and optimal solutions, and interviewer follow-ups.


🎯 Who Is This For? ​

  • Data Engineers preparing for FAANG / Big Tech interviews
  • Analytics Engineers brushing up on advanced SQL patterns
  • Anyone who wants to go beyond LeetCode-style SQL into production-realistic scenarios

📋 Problem Index ​

#ProblemDifficultyCore PatternKey Companies
01Active User Retention & Cohort Churn🔴 HardSelf-joins, date arithmetic, cohort matricesMeta, Netflix, Spotify, Airbnb
02Consecutive Days Active / Streak Analysis🟡 MediumGaps & Islands, ROW_NUMBER differencingSnapchat, Meta, Spotify, LinkedIn
03Top N Products per Category🟡 MediumWindow functions, RANK vs DENSE_RANKAmazon, Walmart, Instacart, DoorDash
04Overlapping Bookings / Resource Contention🔴 HardInterval overlap detection, running maxAirbnb, Google, Uber, Booking.com
05Marketing Attribution Modeling🔴 HardFIRST_VALUE, LAST_VALUE, fractional allocationGoogle, Meta, Pinterest, Snap
06Circular / Ring Transactions (Fraud)🔴 HardRecursive CTEs, graph traversal in SQLPayPal, Stripe, Square, Goldman Sachs
07Unmatched Records Across Massive Tables🟡 MediumAnti-joins, NOT EXISTS vs LEFT JOINAmazon, Apple, Microsoft, Google
08Running Total with Budget Cap🟡 MediumWindow SUM, conditional cumulationNetflix, Uber, Lyft, DoorDash
09Dynamic Pivot / Unpivot🟡 MediumCASE WHEN pivot, CROSS JOIN UNNESTMicrosoft, Amazon, Salesforce, Oracle
10Multi-Step Event Funnel Analysis🔴 HardConditional aggregation, sessionizationMeta, Google, Airbnb, Uber, Spotify
11Median & Percentiles Without Built-ins🟡 MediumROW_NUMBER, COUNT, self-joinGoogle, Meta, Amazon, Microsoft
12Recursive Hierarchy Rollup🔴 HardRecursive CTE, tree aggregationGoogle, Amazon, Salesforce, SAP
13Deduplication with Priority Rules & MERGE🟡 MediumROW_NUMBER partitioning, MERGE upsertSnowflake, Databricks, Netflix, Airbnb
14Time-Weighted Averages (IoT/Sensor)🔴 HardLEAD/LAG, EXTRACT(EPOCH), weighted sumTesla, Honeywell, Samsara, Uptake
15Point-in-Time / Temporal Joins (SCD2)🔴 HardRange joins, SCD Type 2 lookupsNetflix, Airbnb, Stripe, Spotify

🗂️ Difficulty Breakdown ​

DifficultyCountProblems
🟡 Medium7#02, #03, #07, #08, #09, #11, #13
🔴 Hard8#01, #04, #05, #06, #10, #12, #14, #15

🧠 How to Use This Module ​

  1. Read the Problem Statement — understand the business scenario before writing any SQL
  2. Try the Brute Force first — get a working solution, even if slow
  3. Study the Optimal Solution — understand why it performs better
  4. Answer the Follow-Ups — interviewers always extend the problem
  5. Review Key Takeaways — internalize the reusable pattern

TIP

In real interviews, communication matters as much as the code. Practice explaining your approach out loud before writing SQL. Start with edge cases and clarifying questions.


🔗 Pattern Cross-Reference ​

PatternProblems
Window Functions (RANK, ROW_NUMBER, LEAD/LAG)#02, #03, #08, #11, #13, #14
Recursive CTEs#06, #12
Self-Joins#01, #04, #06
Gaps & Islands#02, #04
Anti-Joins / Set Difference#07
Conditional Aggregation#05, #09, #10
Date/Time Arithmetic#01, #02, #14, #15
MERGE / Upserts#13
Temporal / Range Joins#14, #15

📚 Prerequisites ​

Before tackling these problems, ensure you are comfortable with:


Good luck with your interviews! 🚀