SQL Data Analyst — Medium
Key points
- The LAG function looks at the previous row based on the specified order.
- In this case, since the first row has no previous row, the result is NULL.
- This is useful for calculating differences between consecutive rows.
Ready to go further?
Related questions
