Question: Problem 2 . ( 2 0 pts ) Understanding of SQL - I Consider the following relational schema. An employee can work in more than

Problem 2.(20 pts) Understanding of SQL - I
Consider the following relational schema. An employee can work in more than one department;
the pct_time field of the Works relation shows the percentage of time that a given employee
works in a given department.
Emp(eid: integer, ename: string, age: integer, salary: real)
Works(eid: integer, did: integer, pct time: integer)
Dept(did: integer, dname: string, budget: real, managerid: integer)
Use this schema and the material on SQL discussed in this class indicate which SQL statement
corresponds to the query been asked:
a)(5 pts) Print the names and ages of each employee who works in both the Hardware
department and the Software department.
I. SELECT E.ename, E.age
FROM Emp AS E, Works AS W1, Works AS W2, Dept AS D1, Dept AS D2,
WHERE E.eid = W1.eid AND W1.did = D1.did AND D1.dname =Hardware
AND
E.eid = W2.eid AND W2.did = D2.did AND D2.dname =Software
II. SELECT E.Ename, E.age
FROM Emp AS E, Works AS W, Dept AS D,
WHERE E.eid = W.eid AND W.did = D.did AND D.dname =Hardware
AND D.dname =Software
III. SELECT E.Ename, E.age
FROM Emp AS E, Works AS W, Dept AS D,
WHERE E.eid = W.eid AND W.did = D.did AND D.dname =Hardware
INTERSECT
SELECT E.Ename, E.age
FROM Emp AS E, Works AS W, Dept AS D,
WHERE E.eid = W.eid AND W.did = D.did AND D.dname =Software
IV. Both I and II
V. Both I and III
VI. Both II and III
VII. All of the above
VIII. None of the above
Answer: ____

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!