consider a table which contain 4 columns,ename,eno,sal and
deptno, from this table i want to know ename who having
maximum salary in deptno 10 and 20.

Answer Posted / abhishekjaiswal

select last_name,salary from employees where (salary,department_id) in ( select max(salary),
department_id from employees where department_id in (10,20) group by 
department_id) 
/
Output
LAST_NAME                     SALARY
------------------------- ----------
Hartstein                      13000
Whalen                          4400

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is multiple columns?

576


Is null operator in sql?

610


what is bdb (berkeleydb)? : Sql dba

574


What is sql in java?

549


What are different types of tables in sql?

531






what is data control language? : Sql dba

589


What is difference between primary and secondary key?

519


What are the limitations of sql express?

530


what are the authentication modes in sql server? How can it be changed? : Sql dba

703


what is oracle database ? : Sql dba

561


Does sqlite need a server?

543


Explain foreign key in sql?

625


write an sql query to get third maximum salary of an employee from a table named employee_table. : Sql dba

544


What is auto increment feature in sql?

625


What is sql rowcount?

559