Write the query

A employee getting variable salary like Jan 3000,Feb 5000,Mar 1000 ,Apr 7000,May 500 write query to display his next salary "increse" or "decrese" as compare to previous month ,three column in the employee table empname ,salarydate,salary ?

Questions by Koonal saxena   answers by Koonal saxena

Showing Answers 1 - 3 of 3 Answers


  • Jan 20th, 2013

  1. SELECT empname, salarydate, salary, (case when salary < LAG(salary, 1, 0) OVER (ORDER BY empname, salarydate) then increase else decrease end) AS trend

  2. FROM emp;


  • Aug 5th, 2014

It can be done by analytical function using the lead function.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions