An energy company is analyzing electricity usage. Instead of…
An energy company is analyzing electricity usage. Instead of comparing today’s consumption to yesterday’s, they want to compare it to the same day one week earlier. How can this be achieved with LAG? OPTIONS:A. Use LAG with a partitionB. Use LAG with an offset of 7C. Use LEAD with an offset of 7D. Use GROUP BY week instead of day ANSWER:B EXPLANATION:Adding an offset parameter to LAG allows comparisons several rows back (e.g., LAG(value, 7) for a 7-day lookback).
Read Details