eBay Interview Question | Male Employee

Question

Write a SQL query to find the 7th highest employee salary from an Employee Table. If that employee is male, shift to the next employee in alphabetical order. Explain your answer.

in progress 0
Dhruv2301 4 years 1 Answer 895 views Great Grand Master 1

Answer ( 1 )

  1. SEELCT Employee Name , Gender ,CASE WHEN Gender =’Female’ then (Select salary from employees table order by Salary DESC limit n-1,1)ElSE (Select salary from employees table ,order by Salary DESC ,limit n+1,1) END as Salary
    FROM Employees Table ;

Leave an answer

Browse
Browse