it's not correct

interview (intervieweree)
your query equals to this one

SELECT top 1 name, salary from employee WHERE salary NOT IN
( SELECT TOP 1 salary FROM employee ORDER BY salary DESC )
order by salary desc

but imagine if there are more than 1 people
have the same salary which is second highest?
your hardcoded number 2 does not work in thi situation

2002-2-15 -04:00

回到话题: here is the table, write a query to find out who have second highest salary?

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论