Question { HCL, 10632 }
write a query to display to 10 max record from the employee
table?
Answer
To find nth value
select salary from emp a where &n=(select count(distinct
salary) from emp b where a.empno<=b.empno);
to find max by nth value a.empno<=b.empno
to find min by nth value a.empno>=b.empno
OR
To find 10 max records
select * from (select * from emp order by salary desc) where
rownum<=&n;