Join rides and impressions to find rolling 7-day average
Last updated: January 6, 2026
Quick Overview
Write a query joining rides and messages to produce the combined rolling 7-day average.
Oracle
Data Manipulation (SQL/Python)
Data Scientist
Oracle
January 6, 2026Data Scientist
Take-home Project
Data Manipulation (SQL/Python)
Hard
137
6
3,676 solved
Write a query joining rides and messages to produce the combined rolling 7-day average.
Oracle asks this during the Take-home Project 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
Date/time manipulation
Index optimization and query performance
JOIN types and when to use each
Aggregate functions and GROUP BY
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you validate the correctness of your query results?
- How would you handle slowly changing dimensions in this scenario?
- How would you handle this if the data was spread across multiple databases?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Problem Understanding
The problem involves two datasets: 'rides' and 'impressions'. The 'rides' table contains information about ride events, including a timestamp and a unique ride identifier. The 'impressions' table cont...
Approach
- Identify Necessary Columns: We need the ride timestamps and counts from the 'rides' table and the impression timestamps and counts from the 'impressions' table.
- Join Tables: Use a LEFT ...
Submit Your Answer
Markdown supported