Find 2nd Highest salery in emp table
Select* from emp where &n=
select * count from emp where (salery >=emp.salery)
Enter n value 2
These query is correct or not. Tell me any other methods.
Answer Posted / madhu sudhan g
Hii lets consider the table Salary having EMPNO,EMPSal columns
to find the 2nd higest salary
;WITH CTE(Sal,Row)
AS
(
select EMPSal,ROW_NUMBER() OVER(ORDER BY EMPSal) as Row from Salary
)
select sal as Salary from CTE where Row=2
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is wide table?
What it means to be triggered?
Can we call stored procedure in view in sql server?
What is the Disadvantage of indexed sequential file.
What are sql server functions?
what is normalization? Explain different levels of normalization? : Sql server database administration
Indexes are updated automatically is the full-text index also updated automatically?
What are commit and rollback in sql?
How do I install only the client tools of sql server 2000?
what is denormalization? : Sql server database administration
What are the advantages dts has over bcp?
Explain log shipping and mention its advantages.
How to create a new login name in ms sql server?
What is truncate table?
What is instead of dml trigger?