SQL Interview Questions Series

6 books • PUBLIC

Practice SQL interview questions commonly asked at tech companies. Each book presents a real-world scenario, explains the underlying SQL pattern being tested, and provides a dataset to write your solution against. Topics covered include self-joins, window functions, gaps and islands, time-series comparisons, and aggregate filtering. Suitable for anyone preparing for data engineering, analytics, or backend engineering interviews where SQL proficiency is evaluated.

Open Access

Collection Books:
  1. 1. Employees Earning More Than Their Manager
    Compare employee salaries against their managers using self-joins on hierarchical data.
  2. 2. Second Highest Salary Per Department
    Use window functions and DENSE_RANK to find the Nth-ranked value per group while handling ties correctly.
  3. 3. Consecutive Login Days
    Detect streaks in time-series data using the gaps and islands technique with ROW_NUMBER and date arithmetic.
  4. 4. Year-Over-Year Revenue Growth
    Calculate percentage change across time periods by joining a table to itself on offset date keys.
  5. 5. Identifying Churned Customers
    Combine JOIN, aggregate functions, and HAVING to classify customers based on temporal purchase behavior.
  6. 6. Normalize a Flat Order Table
    Identify normalization violations in a denormalized table and redesign it into 3NF with proper primary keys, foreign keys, and constraints.