Answer Posted / srinu
Hi Jyothi,
The below q uery is suitable for Nth max salary....
SELECT a.sal
FROM emp a
WHERE &N=(SELECT COUNT(DISTINCT b.sal)
FROM emp b
WHERE a.sal<=b.sal);
In the above query u can substitute any value like 1,2,..100 etc instead of &n.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Does sql require a server?
what is the functionality of the function htmlentities? : Sql dba
Is merge a dml statement?
How do I enable sql encryption?
what are the advantages of sql ? : Sql dba
Why self join is used in sql?
Which is faster count (*) or count 1?
What is percent sign in sql?
What is dialect in sql?
What is fmtonly in sql?
What does select count (*) mean in sql?
what is a stored procedure? : Sql dba
How do I make my sql query run faster?
What is sql keyword?
Which is better join or subquery?