Employee salary increase with promotion
You are given the following table containing historical employee salaries for company XYZ:
Given the above table, write a SQL query to return the average percent that an employee's salary increased from the prior year when they are promoted.
For example, employee_ID 1 had a promotion in 2020 and their pay increased from 70,000 in 2019 to 80,000 in 2020, or a 14.2% increase from their prior salary. You will need to do this calculation across every record where promoted = 'y' and return the average of the results.
You can view/query this table in an interactive SQL fiddle here.
Subscribe to premium account to see the solution.Get premium now