Exercise

Longest gap

What is the longest time between Evanston 311 requests being submitted?

Recall the syntax for lead() and lag():

lag(column_to_adjust) OVER (ORDER BY ordering_column)
lead(column_to_adjust) OVER (ORDER BY ordering_column)

Instructions

100 XP
  • Select date_created and the date_created of the previous request using lead() or lag() as appropriate.
  • Compute the gap between each request and the previous request.
  • Select the row with the maximum gap.