Output:
salary
-------
5000
8000
9000
6000
7000
Explanation:
Below sql snippet selects single row from temp table.
select A.salary from @table as A
Here where condition is a sub query. Lets checkout this sub query.
select count(*) from @table B where b.salary < A.salar
This query gives the
counts of those whose salary is greater than the salaries of
A.
If this
count is greater than 5 then those salaries will be printed!