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

Answer Posted / anonymous

select emp_id from employee where dept in (select distinct
dept from employee) group by emp_id having count(*) >1;

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of db2?

586


What is the difference between "db2ilist" and "db2 get instance" commands in DB2 Database Server?

705


Is db2 relational database?

570


How and when does the db2 enforces the unique key?

613


What is a db2 cursor?

622






What happens in bind step in a db2 program?

563


What is difference between alias and synonym in db2?

639


What is rct?

751


What is isolation level in db2?

577


What is performance tuning db2?

614


When the like statement is used?

634


Why do we use cursor?

597


What is the physical storage length of the data types: date, time, timestamp in the db2 database?

644


Is db2 a mainframe database?

563


Mention the way of highlighting as well as putting a cursor to use in a cobol program.

624