Consecutive increases in annual earnings
Suppose you are given two tables, showing the number of hours worked as well as the hourly rates for specific employees by year:
Given the above tables, write a SQL query to return the employees who generated more income (hours * hourly rate) in at least two consecutive years (either 2018-2019, 2019-2020, or all three years from 2018-2020).
You can view/query these tables in an interactive SQL fiddle here.
Subscribe to premium account to see the solution.Get premium now