43. Calculating Average Time Differences

This advanced SQL exercise is part of the book: Advanced SQL – Practical Techniques and Use-Cases, which includes 100 day-to-day SQL challenges (and solutions), need-to-know advanced features, and key concepts.

An online gambling site manages the following table. This table documents the dates when an error has occurred in the system. As you can see, two days passed between error no. 1 and error number 2, 6 days passed between error number 2 and error number 3 and so on.

(id int identity(1,1),
fdate DATE)

To read more

UpScale Analytics is one of the largest platforms in the world for learning SQL by doing, consisting over 300 SQL exercises at different levels (including solutions), by topics, across over 100 different datasets. More…