For each of the following SQL queries, for each relation involved, list the attr
ID: 3926578 • Letter: F
Question
For each of the following SQL queries, for each relation involved, list the attributes that must be examined to compute the answer. All queries refer to the following relations: Emp(eid: integer, did: integer, sal: integer, hobby: char(20)) Dept(did: integer, dname: char(20), floor: integer, budget: real) a. SELECT COUNT(*) FROM Emp E, Dept D WHERE E.did = D.did b. SELECT MAX(E.sal) FROM Emp E, Dept D WHERE E.did = D.did c. SELECT MAX(E.sal) FROM Emp E, Dept D WHERE E.did = D.did AND D.floor = 5 d. SELECT E.did, COUNT(*) FROM Emp E, Dept D WHERE E.did = D.did GROUP BY D.did
Explanation / Answer
a. The attributes that must be examined to compute SELECT COUNT(*) FROM Emp E, Dept D WHERE E.did = D.did is E.did, D.did
b. The attributes that must be examined to compute SELECT MAX(E.sal) FROM Emp E, Dept D WHERE E.did = D.did is E.sal, E.did, D.did
c. The attributes that must be examined to compute SELECT MAX(E.sal) FROM Emp E, Dept D WHERE E.did = D.did AND D.floor = 5 is E.sal, E.did, D.did, D.floor
d. The attributes that must be examined to compute SELECT E.did, COUNT(*) FROM Emp E, Dept D WHERE E.did = D.did GROUP BY D.did is E.did, D.did
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.