I Have Employee table having column name as ID,SALARY
how to get second max salary from employee table with id
ex
ID SALARY
1 20000
7 37000
2 5000
Answer Posted / bhagya
select * from emp as e1 where 1= (select count(*)from emp
as e2 where e1.sal<e2.sal)
| Is This Answer Correct ? | 9 Yes | 11 No |
Post New Answer View All Answers
What is the difference between a function and a trigger?
Explain difference between control flow and data flow?
How to test values returned by a subquery with the in operator?
List out different types of normalizations in sql server and explain each of them?
What is the Difference Between Primary and Foreign Key?
What is the Control Flow in SSIS
What are indexes in sql?
Write a SQL command to insert and update only a particular field?
What does set rowcount do?
We are updating a field in sql and alter the row also.after giving the commit command the system is crashed.what will happen to the commands given,whether it will update and alter the table or not?
What is 1nf 2nf?
How to assign null values to variables or columns?
How to copy the tables, schema and views from one sql server to another?
What are the difference between primary keys and foreign keys?
How to drop an existing user defined function in ms sql server?