Resolved: Why null values
Why these values are null?
Thanks for reaching out.
It is because we do not have a value for these columns. When we have the last or the first salaries we do not have the next and the previous values.
Hope this helps.
There are null values because we have used PARTITION BY emp_no in windows function and hence the LAG() and LEAD() works as if every individual emp_no is a separate part which is in partition
i.e, It does not take the salary of the previous employee and the next employee into account. So there is no previous and next value of the same employee to display.
This explains the null values at the beginning and at the end of every employee partition, I hope.