ALLInterview.com :: Home Page Forum9.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   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories >> Software >> MainFrame >> IBM-MainFrame >> DB2
 
 


 

 
 COBOL interview questions  COBOL Interview Questions
 JCL interview questions  JCL Interview Questions
 CICS interview questions  CICS Interview Questions
 DB2 interview questions  DB2 Interview Questions
 IMS interview questions  IMS Interview Questions
 IDMS interview questions  IDMS Interview Questions
 Natural interview questions  Natural Interview Questions
 ADABAS interview questions  ADABAS Interview Questions
 REXX interview questions  REXX Interview Questions
Question
In a single table,How to retrieve a employee-id of an 
employee who works in more than one department?
 Question Submitted By :: Anagha
I also faced this Question!!     Rank Answer Posted By  
 
  Re: In a single table,How to retrieve a employee-id of an employee who works in more than one department?
Answer
# 1
select employee_id from employee table where department in 
('a1','a2','b1','b2');
 
Is This Answer Correct ?    0 Yes 1 No
G.kameswara Reddy
 
  Re: In a single table,How to retrieve a employee-id of an employee who works in more than one department?
Answer
# 2
Select emp_id from employee where dept IN (select all       
dept from employee);
 
Is This Answer Correct ?    0 Yes 1 No
Prasenjit_in
 
 
 
  Re: In a single table,How to retrieve a employee-id of an employee who works in more than one department?
Answer
# 3
Select emp_id from employee where dept IN (select DISTINCT 
dept from employee);
 
Is This Answer Correct ?    0 Yes 0 No
Ab
 
  Re: In a single table,How to retrieve a employee-id of an employee who works in more than one department?
Answer
# 4
Select emp_id
from
employee
group by emp_id,dept
having count(*)>1;
 
Is This Answer Correct ?    1 Yes 0 No
Varun
 
  Re: In a single table,How to retrieve a employee-id of an employee who works in more than one department?
Answer
# 5
hi all i hope this answer will help you


                emp
eid        ename        dep
001        manikandan   mainframe
002        karthi       java
003        jarin        mainframe
001        manikandan   java
003        jarin        testing
004        hariharan    java
001        manikandan   testing

select eid from emp e1 where 1 <
               
          (select count(*) from emp e2 where e1.eid=e2.eid)

let me know if any new answer
 
Is This Answer Correct ?    1 Yes 0 No
Manikandan.d
 
  Re: In a single table,How to retrieve a employee-id of an employee who works in more than one department?
Answer
# 6
select employee-id
 from  table-name
 grtoup by employee-id
 having count(*) > 1
 
Is This Answer Correct ?    0 Yes 0 No
Krishnakumar
 
  Re: In a single table,How to retrieve a employee-id of an employee who works in more than one department?
Answer
# 7
ans 5 need to be corrected...

subquery will fetch correct result but main query hw it 
will compare... ???

it supposed to be where eid exists(select eid...where 
e1.eid= e2.eid)
 
Is This Answer Correct ?    0 Yes 1 No
Ram.g
 
  Re: In a single table,How to retrieve a employee-id of an employee who works in more than one department?
Answer
# 8
Another classic example of people replying to the queries 
in hurry..the answer #1, #2, #3, #4 & #7 are WRONG ANSWERS. 
Answer #6 is correct. Answer #5 also seems to be correct to 
me (unfortunatley I can't run & verify it at the moment, 
someone please verify it & let everyone know). 

Ram.g, FYI..EXISTS clause just denotes whether query after 
EXISTS clause returned any row or not, it NEVER give a 
count of the number of rows returned. Here need to find if 
there are more than one rows (i.e count is needed) so 
EXISTS can't be used here.
 
Is This Answer Correct ?    0 Yes 0 No
Vish
 
  Re: In a single table,How to retrieve a employee-id of an employee who works in more than one department?
Answer
# 9
Ans 5 is also correct but it seems a bit compliceted
 
Is This Answer Correct ?    0 Yes 0 No
Krishnakumar
 
 
 
 
Other DB2 Interview Questions
 
  Question Asked @ Answers
 
What does this mean ? GRANT BIND,EXECUTE ON PLAN MK2 TO PUBLIC; Accenture3
I need to view the number of tables existing under one particular Owner. Is it possible? If so, pl give the SQL query for this?  1
What is a thread?  1
What is cursor stability?  1
What do you mean by NOT NULL? When will you use it?  2
What is lock escalation?  1
What is the FREE command?  1
What does CURRENTDATA option in bind indicate  1
Is it possible to precompile if db2 goes down? Target4
What is a cursor and what is its function?  2
max number of columns in a db2 table?  2
What is the COBOL picture clause of the following DB2 data types: DATE, TIME, TIMESTAMP?  2
Name the different types of Table spaces.  2
What is the maximum number of tables that can be stored on a Partitioned Table Space ?  1
Where besides the DB2 catalog is database object information stored by DB2?  1
what is copy pending and check pending ? Xansa1
What are the three DB2 date and time data types and their associated functions?  1
What is DCLGEN?  2
What is the purpose of the DSNC transaction ?  1
What is pagespace?  1
 
For more DB2 Interview Questions Click Here 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

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