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 / elumalai.k

select id,max(salary)from employee where salary<(select
max(salary)from employee)

Is This Answer Correct ?    15 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What command do we use to rename a database?

690


What do you mean by data integrity?

673


What is the difference between an index and a unique index?

639


What is 5nf in normalization form?

647


How to change a login name in ms sql server?

645






When cursors are useful?

654


What method is used by the Command classes to execute SQL statements that return single values?

676


How to create a view on an existing table in ms sql server?

698


Explain iaas, paas and saas?

80


What are indexes in sql?

664


What programming language would you use to create embedded functions in ssrs?

144


Ways to improve the performance of a SQL Azure Database?

109


What is the name of the system variable that returns the number of rows affected by a SQL statement?

659


What are the different types of columns types constraints in the sql server?

604


How to insert data with null values?

683