Hi,
Can anybody please explain me the flow of the below query.
I am not able to understand how this query works.
This query is for finding the Nth highest salary..
SELECT DISTINCT (a.sal)
FROM EMP A
WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B
WHERE a.sal<=b.sal);
If N = 2 then second highest salary will be the o/p.
If N = 3 then third highest salary will be the o/p.
and so on..
Thanks,
Nitin
Answer Posted / nitin
Thank you.
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Write a query to find the names of users that begin with "um" in sql?
What is pl sql variable?
What are the ddl commands?
What is a field in a database?
How do temporal tables work?
What's the difference between a primary key and a clustered index?
Is pl sql still used?
What is transaction control language (tcl)?
First round ------------------- - Procedure - Packages - Views - Virtual tables - Can we use dcl with in function? - Joins and few scenarios - Triggers and its type - Pragma, type and its functionality - How to create db link in oracle - Materialized view - How to find duplicate values from table? - Cursor and its functionality - Write a script to display friday and its date from a entire year. - Exception Handling Second round ------------------------ Gave a scenario like. Need to write a function to perform. When user try to change a password. It must not be last five password and a given password can be combination of characters, symbols, upper and lower case.
Mention what are different methods to trace the pl/sql code?
What are the syntax and use of the coalesce function?
how many triggers are allowed in mysql table? : Sql dba
Can unique keys be null?
What is a function in oracle pl sql?
Explain clause in sql?