The lead and lag window functions in Databricks SQL are strong when analyzing sequences.
Want to know how much time passed between two events, e.g. customer purchases? Use the lag function utilizing the customer-id and the purchasing date as the window and compute the difference with ease. No pivoting or joins required.
What is your favorite lead/lag use case?
https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/functions/lead

