ALLInterview.com :: Home Page KalAajKal.com
 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                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Java J2EE  >>  Java Related  >>  JDBC
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
write a query to select name from one table which has 
id,name and salary from another table which has id, sal 
where the salary is the second maximum
 Question Submitted By :: Anonymus
I also faced this Question!!     Rank Answer Posted By  
 
  Re: write a query to select name from one table which has id,name and salary from another table which has id, sal where the salary is the second maximum
Answer
# 1
Select emp.name, emp.id, sal.salary from empDetai emp, 
empSal sal 
where emp.id=
  (select innnerEmp.id from 
   (select innerEmpSal.id, innerEmpSal.sal from empSal    
order        innerEmpSal.salary desc

    ) where rowid=2;

  )
And emp.id=sal.id;

This queiry initially execute the inner query and sort 
records based on the salary. second inner query returns the 
id of second maximum salary.
 
Is This Answer Correct ?    3 Yes 4 No
Bln
 
  Re: write a query to select name from one table which has id,name and salary from another table which has id, sal where the salary is the second maximum
Answer
# 2
select emp.name,emp.id,sal.salary from empDetail emp,empSal
sal where sal.salary < (select max(salary) from empSal) and
emp.id=sal.id order by desc limit 1;
 
Is This Answer Correct ?    7 Yes 0 No
Raveendra Reddy
 
 
 

 
 
 
Other JDBC Interview Questions
 
  Question Asked @ Answers
 
Different statements in JDBC?  2
Can we use the one instance of Statment to execute more than one query ? TCS2
Difference between Generic Servlet and HTTP Servlet?  7
how do we get the connection from connection pool  1
How does JDBC differ from ODBC?  7
wahts is mean by primary key and unique key? Wipro7
Can you create an index on sex column where there is M or F? Wipro1
commit() and rollback() methods are defined in which interface?  4
Does multiple concurrent open statements per connection are supported by the JDBC-ODBC Bridge?  2
What are JDBC statements?  2
Is JDBC a language or Application?  2
How we say that PreparedStatment is Precompiled? where it will be compiled? Logica-CMG3
Are there any ODBC drivers that do not work with the JDBC- ODBC Bridge?  1
What is PreparedStatement? Infogain5
which scenarios we go for jdbc,and which scenario we go for connection polling and wat r advantages and disadvantages using connection pooling. TCS2
What type of drivers are used for web application?  2
what exactly happens when we execute "Class.forname("Driver class name");"?Explain indetail Trigent10
how to use CallableStatement? specially how to use their index given ..  1
Difference between servlet and applet method?  1
What is Statement and PreparedStatement? whatz the difference?  2
 
For more JDBC Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com