For each of the following SQL queries for each relation invo

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

Solution

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

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 fol

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site