To find second largest salary in Employee table
Answer Posted / ram
select *from emp e where &n in(select count(distinct sal)
from emp m where e.sal<=m.sal);
which will ask's u like :
enter the value for n : 2 (enter 2)
gives u second highest.
Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is difference between inner join and full join?
Can you explain different types of joins?
What is store procedure? When do you use?
Does a sql server 2005 select statement require a from?
How many clustered indexes there can be on table ?
What is recompile sql server?
What is data modeling and Reterminal integrity?
What is a bit datatype?
How will you hide an attribute? : sql server analysis services, ssas
What does the on delete cascade option do?
How optimize sql query with multiple joins in sql server?
What is multi-statement table-value user-defined function?
Can we return Data from 4(more than 1) tables in stored procedure?
What is deploy, process and build? : sql server analysis services, ssas
What happens if ntwdblib.dll is missing on your machine?