Question: Find out nth highest salary from emp table
Answer: select sal from emp E wherenulln-1=(select count( distinct sal) from emp where sal>E.sal);
select sal from emp E wherenulln-1=(select count( distinct sal) from emp where sal>E.sal); Source: CoolInterview.com
select sal from emp e where &n - 1 = (select count(*) from emp where sal > e.sal); Source: CoolInterview.com
select sal from emp where rowid=n order by sal desc; Source: CoolInterview.com
Rules to Post Answers in CoolInterview.com:- There should not be any Spelling Mistakes. There should not be any Gramatical Errors. Answers must not contain any bad words. Answers should not be the repeat of same answer, already approved. Answer should be complete in itself.
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.