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
What are sql commands?
Describe types of sql statements?
What is difference between group by and partition by?
how to get help information from the server? : Sql dba
Is it possible to create startup or shutdown trigger for on-schema?
What does dml mean?
Define select, insert, create, delete, update, drop keywords
What is the difference between between and in condition operators?
What are the constraints available in sql?
how can we destroy the session, how can we unset the variable of a session? : Sql dba
what are the properties and different types of sub-queries? : Sql dba
How will you distinguish a global variable with a local variable in pl/sql?
How to raise user-defined exception with custom sqlerrm ?
Explain aggregate functions are available there in sql?
What is difference between db2 and sql?