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
Are stored procedures faster than dynamic sql?
Is pl sql still used?
What is record type in pl sql?
What are the two types of cursors in pl sql?
What is the difference between sum and count in sql?
What is meant by user defined function?
Which join is default?
What is the sql case statement?
What is a behavioral trigger?
Can we use update in sql function?
How do I run a sql query?
What is the difference between the implicit and explicit cursors?
Write the order of precedence for validation of a column in a table? I. Done using database triggers. Ii. Done using integarity constraints
Which is better join or subquery?
what is the maximum length of a table name, database name, and fieldname in mysql? : Sql dba