For instance, we have a problem of finding the employee with the second highest salary in the table. This is my table
id name dept salary 1 Ram HR 10000 2 Amrit MRKT 20000 3 Ravi HR 30000 4 Nitin MRKT 40000 5 Varun IT 50000
Then I would write a subquery like this.
select e_name,salary from employee where salary = (select max(salary) from employee where salary <> (select max(salary) from employee));
And I would use limit and offset like this:
select e_name, salary from employee order by salary desc limit 1 offset 1;
Which of the following would be more efficient? and why?