SQL Window Functions
1. row_number()
•Business
Use Case – We want to isolate only rows for employees with the their most recent salaries
•Could
be still active
employees, i.e. to_date =
‘9999-01-01’ or
employees
who have left the company**,
what was their salary when they left?
2. lead/lag
- lead ———take value from row below
1) wrong ex:
2) correct ex:
- lag ———take value from row above