neha


{ City } bangalore
< Country > india
* Profession * sse
User No # 72668
Total Questions Posted # 1
Total Answers Posted # 4

Total Answers Posted for My Questions # 0
Total Views for My Questions # 2064

Users Marked my Answers as Correct # 2
Users Marked my Answers as Wrong # 12
Questions / { neha }
Questions Answers Category Views Company eMail

Please post the scenerois for writing the complex sql queries , for my practice.Can be any query if you cannot solve.

Databases AllOther 2064




Answers / { neha }

Question { 8885 }

write a query to find the third maximum salary of a
employee.(table:employ col name:salary)


Answer

select ename,sal from (select rownum rnum ,rowid rid from
emp order by sal desc) a , emp e
where a.rnum = 4
and a.rid= e.rowid

Is This Answer Correct ?    0 Yes 1 No

Question { 8885 }

write a query to find the third maximum salary of a
employee.(table:employ col name:salary)


Answer

select e.ename,a.sal from (select sal, rownum rnum ,rowid
rid from (select * from emp order by sal desc)) a , emp e
where a.rid= e.rowid
and a.rnum = 3

Is This Answer Correct ?    1 Yes 0 No


Question { 12138 }

How to select the name of employee who is getting maximum
sal with out using subquery


Answer

select a.ename from (select ename from emp ORDER BY SAL
desc,ROWNUM DESC)a
where rownum=1;

Is This Answer Correct ?    0 Yes 1 No

Question { CTS, 9134 }

sql query to get zero records from a table


Answer

select null from emp

Is This Answer Correct ?    1 Yes 10 No