A payroll ETL job was supposed to UPDATE each employee's salary once a year, but a bug caused it to INSERT a brand-new row every time instead. As a result, the table salary_history is append-only: it holds the full history of every salary an employee has ever had, one row per change, stamped with an effective_date.
Your task is to reconstruct each employee's CURRENT salary. For every employee, return the salary tied to their most recent effective_date. Because of a separate double-write glitch, a single employee may have two rows sharing the exact same maximum effective_date with different salary values; when that happens, treat the LARGER salary as the current one.
Return two columns, employee_id and salary, with one row per employee, ordered by employee_id ascending.