In a single table,How to retrieve a employee-id of an
employee who works in more than one department?

Answers were Sorted based on User's Feedback



In a single table,How to retrieve a employee-id of an employee who works in more than one departme..

Answer / venkat

SELECT EMPLOYEE-ID FROM EMPLOYEE GROUP BY EMPLOYEE-ID,DEPARTMENT HAVING COUNT( DEPARTMENT ) > 1;

Is This Answer Correct ?    0 Yes 2 No

In a single table,How to retrieve a employee-id of an employee who works in more than one departme..

Answer / karthik

select dept,empid , count(*)
from table
goup by dept,empid
having count(*) > 1

Is This Answer Correct ?    0 Yes 3 No

In a single table,How to retrieve a employee-id of an employee who works in more than one departme..

Answer / g.kameswara reddy

select employee_id from employee table where department in
('a1','a2','b1','b2');

Is This Answer Correct ?    7 Yes 11 No

In a single table,How to retrieve a employee-id of an employee who works in more than one departme..

Answer / prasenjit_in

Select emp_id from employee where dept IN (select all
dept from employee);

Is This Answer Correct ?    4 Yes 9 No

In a single table,How to retrieve a employee-id of an employee who works in more than one departme..

Answer / ab

Select emp_id from employee where dept IN (select DISTINCT
dept from employee);

Is This Answer Correct ?    2 Yes 8 No

Post New Answer

More DB2 Interview Questions

what is utility for parm lib

0 Answers   IBM,


When would you prefer to use VARCHAR?

3 Answers  


What is meant by repeatable read?

4 Answers  


what are the max. & min. no. of partitions allowed in a partition tablespace?

2 Answers   IBM,


Is db2 a mainframe?

0 Answers  






Explain transactions, commits and rollbacks in DB2.

3 Answers  


How is the value function used?

0 Answers  


How do you prepare a COBOL + DB2 program from coading till execution ?

1 Answers   Amdocs, Xansa,


Is it possible to precompile if db2 goes down?

4 Answers   Target,


Why use RUNSTAT Utility?

3 Answers   Merrill Lynch,


What is the physical storage length of timestamp data type?

0 Answers  


Hi All, In a Cobol-DB2 program, I am fetching rows from 4 tables using cursor and then based on the a field present in that table, It processes the information accordingly..for example stat-c is one digit field..if stat-c is 'D' then the a row is deleted from table and written those details in to a file. If the stat-c is 'U' then a row is updated (hardcoded what to update)in a table and written those details in to a file. If the stat-c is 'I' then a row is inserted in a table and written those details in to two files. The issue is i have to include the intermediate commits. When an abend occurs, due to commit statement db2 tables will be saved, But there will be lose of file contents. When we resubmitting the job associated with this program there will be insert ,update and delete anomolies to avoid that what measures could be taken?. The intermediate commit is nothing but issuing commit after massive inserts, updates and deletes(sum of 500actions)

1 Answers  


Categories