Replicated sample query with example.
select
current_rec .*
,compare_rec.employee_id as less_salary_employee
from
hr.employees current_rec
left join hr.employees compare_rec
on current_rec.hire_date < compare_rec .hire_date and current_rec.salary < compare_rec.salary
order by current_rec .employee_id ;
how can i optimize the above query. Please suggest.