aditya kumar bisoi


{ City } chennai
< Country > india
* Profession * analyst programmer
User No # 100988
Total Questions Posted # 0
Total Answers Posted # 2

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

Users Marked my Answers as Correct # 5
Users Marked my Answers as Wrong # 1
Questions / { aditya kumar bisoi }
Questions Answers Category Views Company eMail




Answers / { aditya kumar bisoi }

Question { Oracle, 51189 }

How to find the second largest salary in the emp database and
also How to find 3rd,4th and so on ........ in the emp database

plz mail the answer @ mak2786@gmail.com


Answer

SELECT EmpId,Salary
FROM(SELECT ROW_NUMBER() OVER(ORDER BY Salary Desc) AS [ROW_NUMBER],* FROM (SELECT DISTINCT Salary,Empid FROM EMPDetails)Emp)Emp1
WHERE ROW_NUMBER BETWEEN 2 AND 5

Is This Answer Correct ?    0 Yes 1 No

Question { Cap Gemini, 17954 }

What is the difference between WHERE AND IN?
OR
1. SELECT * FROM EMPLOYEE WHERE EMPID=123
2. SELECT * FROM EMPLOYEE WHERE EMPID IN (123)
WHAT IS THE DIFFERENCE?


Answer

Actually Both Query will return Same Result....
But Performance wise 1st Query better..Bcz it will return the Exact Record with out check hole record in the table....

But when we use IN operator then the sql engine will do the Table scan and retrive the Result...

Is This Answer Correct ?    5 Yes 0 No