Multiple choice

What does the following select statement do? Select fname,lname from employees where exists (select * from dependent where ssn=essn) and exists (select * from department where ssn=mgrssn);

Consider Table: Employee(fname,minit,lname,ssn,bdate,add,salary,dno)
Department(dmname,dno,mgrssn,mgrstartdate)
Work_on(essn,pno,hours)
Project(pname,pno,plocation,dno)
Dept_locations(dno,dlocation)

  1. Lists the names of all the employees who have managers

  2. Lists the names of all the managers who have dependents

  3. Lists the names of managers who have at least one dependent

  4. Lists the names of employees with at least one dependent

  5. None of these

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The 'and' condition exists between two subqueries. So, the complete query retrieves list of names of managers who have at least one dependent.