Data Engineering interview question

Write SQL that calculates a 7-day rolling average of daily revenue, including days with no orders.

Hands-on Asked in Data Engineer · Machine Learning Engineer interviews

Members can save this page, take notes and track progress. See membership · Sign in

Summary

Generate a continuous date series, left join daily revenue onto it so missing days count as zero, then use a window function over the previous six rows plus the current one. Without the date series, gaps would make "7 rows" span more than seven days.

Keep reading with a membership

The full answer with examples, key points and comparisons is part of the membership, along with every other interview answer, progress tracking and Daily Review. Most-asked answers stay free to read.

See plans and free trial Already a member? Sign in

More Data Engineering questions

← All Data Engineering questions

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake