:: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Categories >> Software >> Databases >> SQL PLSQL


 Oracle interview questions  Oracle Interview Questions (2036)
 SQL Server interview questions  SQL Server Interview Questions (1076)
 MS Access interview questions  MS Access Interview Questions (24)
 MySQL interview questions  MySQL Interview Questions (194)
 Postgre interview questions  Postgre Interview Questions (6)
 Sybase interview questions  Sybase Interview Questions (22)
 DB Architecture interview questions  DB Architecture Interview Questions (5)
 DB Administration interview questions  DB Administration Interview Questions (213)
 DB Development interview questions  DB Development Interview Questions (53)
 SQL PLSQL interview questions  SQL PLSQL Interview Questions (771)
 Databases AllOther interview questions  Databases AllOther Interview Questions (106)
Write a query to get 2nd maximum salary in an employee table ?
 Question Submitted By :: SQL-PLSQL
I also faced this Question!!     Answer Posted By  
# 1
select max(sal) from emp where sal<(select max(sal) from
Is This Answer Correct ?    189 Yes 36 No
# 2

THIS will surly give 2^nd max sal ok this correct ans ok....
Is This Answer Correct ?    75 Yes 13 No
Kotravel. B
# 3
select * from emp a where 2=(select count(distinct sal)
from emp b where a.sal<=b.sal)
Is This Answer Correct ?    41 Yes 8 No
# 4
select * from emp a where 2=(select count(distinct sal)
from emp b where a.sal<=b.sal)
Is This Answer Correct ?    27 Yes 6 No
# 5
select empno,ename,sal
from (select ename,empno,sal,dense_rank()
over(order by sal desc)topn
from emp)
where topn=2
Is This Answer Correct ?    62 Yes 45 No
# 6
select a.sal
from (
select sal ,rownum no
from (
select distinct sal
from emp
order by sal desc
) a
Is This Answer Correct ?    15 Yes 5 No
Khandu Shinde
# 7
select max(sal) from emp where sal<(select max(sal) from
Is This Answer Correct ?    14 Yes 4 No
# 8
Select Max(Sal)
From Emp E
Where E.Sal < (Select Max(Sal) From Emp)
Is This Answer Correct ?    8 Yes 1 No
# 9
The best answer should be the first one, this is because
the sql statement accesses table emp only once.
Is This Answer Correct ?    9 Yes 6 No
# 10
Hi friends i think it is surely work because i worked for this.

select * from emp e where 1=(select count(distinct d.esal)
from emp d where d.esal>e.esal)

any one plz try if it's not work

plz let me know.
Is This Answer Correct ?    6 Yes 3 No

Other SQL PLSQL Interview Questions
  Question Asked @ Answers
Delete the emps whose salaries are lowest sals of their own dept.   5
can we delete the trigger in a view? if yes why if not why? Tech-Mahindra 5
25.67,-1 Trunc = 20 Round= 30 HOW???? Karrox 2
how to calcuate the second highest salary of he employee Synechron 12
hi..........i m Accenture employee...Accenture is an IT company having itz branches in India at Mumbai, Pune,Delhi, Hyderabad, Chennai and Bangalore....Presently there are openings here for SAP, Testing, Oracle,Java,.NET,MAinframe and Peoplesoft...... I am a software engineer working with Accenture,Mumbai....u can mail me in your resume..i`ll forward it to our HR mail id: Wipro 6
PL/SQL allocates memory for the variable's at runtime or at compile time   3
package specification-3 procedures package body-4 procedures how can i write for other procedure in package body Reliance 2
How to return multiple records from procedure?   2
what is sql profiler Fidelity 2
what is the command for user data type?   2
If the base table structure is changed what will happen to join index????   2
What are the different types of PL/SQL program units that can be defined and stored in ORACLE database ?   2
For more SQL PLSQL Interview Questions Click Here 

Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
Copyright 2013  All Rights Reserved.   ::