Head First SQL. How the query works As we can see this query involves use of an inner query. Once you know the generic logic to solve this problem, you can tackle all those variations by yourself. That's all about how to find the nth highest salary in SQL. Our nth highest salary is an example of correlated query.
This is more than enough to answer the SQL interview question, the print nth highest salary of an employee in the Oracle. Create a new database schema.
Uncorrelated query is where inner query can run independently of outer query, and correlated query is where inner query runs in conjunction to outer query. The outer query will then pick the top most salary, which would be your Nth highest salary.
Performance analysis As we learned above that inner query executes every time, one row of outer query is processed, this brings a lot of performance overhead, specially if the number of rows are too big. Feedback, Discussion and Comments.
It's slow but it can solve problems which are difficult to solve otherwise. Cons : 1 Slow, because the inner query will run for every row processed by the outer query. A family guy with fun loving nature.