Join impressions and messages to find percentile rank

Last updated: September 12, 2025

Quick Overview

Write a query joining impressions and clicks to produce the combined percentile rank.

Adobe
Data Manipulation (SQL/Python)
Data Scientist
Adobe
September 12, 2025
Data Scientist
Phone Screen
Data Manipulation (SQL/Python)
Hard

203

2

3,265 solved


Write a query joining impressions and clicks to produce the combined percentile rank.

Adobe asks this during the Phone Screen because data engineering skills are critical for the role. You should be comfortable with complex joins, window functions, CTEs, and performance optimization.

What the Interviewer Expects
  • Solve complex analytical problems with elegant, readable SQL
  • Optimize queries for large-scale datasets with partitioning and indexing
  • Use recursive CTEs, lateral joins, and advanced window functions
  • Design the data model alongside the query solution
  • Discuss trade-offs between SQL and programmatic approaches (Python/pandas)
  • Consider the operational aspects: query scheduling, incremental processing
Key Topics to Cover
NULL handling and COALESCE
Pandas vectorized operations and groupby
Common Table Expressions (CTEs)
Aggregate functions and GROUP BY
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 validate the correctness of your query results?
  • What indexes would you create to support this query?
  • How would you handle this if the data was spread across multiple databases?
  • How would you handle slowly changing dimensions in this scenario?
Sharpen Your Skills on Codemia

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

Practice SQL Problems
Sample Answer
Problem Understanding

In this problem, we are tasked with joining two datasets: impressions and clicks. Each dataset contains information about user interactions with ads. The impressions table includes fields such a...

Approach

To accomplish this, we can break down our query into several steps:

  1. Join the Tables: Use a LEFT JOIN to combine impressions and clicks on ad_id and user_id, ensuring we still include im...

Submit Your Answer
Markdown supported

Related Questions