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

Answers were Sorted based on User's Feedback



write a query to select name from one table which has id,name and salary from another table which ..

Answer / raveendra reddy

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 ?    10 Yes 1 No

write a query to select name from one table which has id,name and salary from another table which ..

Answer / nagendra kumar m r

select top 1 e.[id],e.[name],s.salary from emp e join
emp_sal s on e.[id] = s.[id] and e.[id] in (select top 2
[id] from emp_sal order by salary desc)

Is This Answer Correct ?    1 Yes 1 No

write a query to select name from one table which has id,name and salary from another table which ..

Answer / bln

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 ?    4 Yes 5 No

Post New Answer

More JDBC Interview Questions

Does multiple concurrent open statements per connection are supported by the JDBC-ODBC Bridge?

2 Answers  


Discuss the significances of jdbc.

0 Answers  


How do I find ojdbc jar version?

0 Answers  


What is the latest version of JDBC? What new features are added?

4 Answers  


Can I enable requests to a jdbc connection pool for a database connection to wait until a connection is available?

0 Answers  


What is correlated subquery?

0 Answers   emc2, JK Technosoft,


Is the JDBC-ODBC Bridge multi-threaded?

2 Answers   Wipro,


How to update a resultset programmatically?

0 Answers  


What is the difference between client and server database cursors?

0 Answers  


What is odbc. how is it related to sql cli?

0 Answers  


How can I get information about foreign keys used in a table?

0 Answers  


JDBC Drivers properties?

1 Answers   Infosys,


Categories