InterviewStack.io LogoInterviewStack.io

Window Functions and Time Series Analytics Questions

Advanced SQL window functions: ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, and aggregate functions (SUM, COUNT, AVG) with OVER and partition clauses. Using window functions to solve practical problems: ranking users or events within segments, calculating running totals and cumulative metrics, identifying trends and transitions over time, detecting patterns in user behavior sequences. Applications: cohort retention analysis (calculating retention rates across cohorts), user lifetime value trends, engagement metrics over time windows, and sequential user actions.

HardTechnical
55 practiced
Discuss trade-offs between computing time-series and windowed analytics in SQL (data warehouse) vs exporting data to Python/R for analysis. Focus on latency, scalability, reproducibility, maintainability, and skillset of a BI team.
HardTechnical
65 practiced
You need to build features for a churn model using only SQL in the warehouse. Propose a set of features (recency, frequency, monetary, trend) computed using window functions over user activity and sketch SQL for each feature. Also describe how you would validate these features before modeling.
MediumTechnical
62 practiced
Explain how window functions interact with GROUP BY, aggregate functions, WHERE and HAVING clauses. Provide an example where attempting to filter on a window function result in WHERE fails, and show how to correctly filter by using a subquery or CTE.
MediumTechnical
65 practiced
Implement SQL to compute N-day active users (e.g., 7-day active users) given events(user_id, event_date). Show how to compute DAU, WAU (7-day active users), MAU (30-day active users), and retention ratios like DAU/WAU. Discuss efficiency when computing distinct users over sliding windows.
MediumTechnical
58 practiced
Given time-series metrics(user_id, metric_date date, value numeric), write SQL to flag anomalies where the current value is greater than mean + 3 * stddev over the past 30 days for that user. Include handling for small sample sizes and explain any assumptions.

Unlock Full Question Bank

Get access to hundreds of Window Functions and Time Series Analytics interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.