And with no support of window functions, which also were not covered? Apart from looking to the solution right away, of course?
What’s the point of giving a practice exercise after the course if it by definition can’t be solved with the info from the course itself?
Course: https://www.educative.io/collection/5352985413550080/6335716377231360
Lesson: https://www.educative.io/collection/page/5352985413550080/6335716377231360/5327494434521088