I have the following tables and I want to know Jack’s dob, salary and the total score of that employee who who is also a player. The The relational schemas are:
Employee_Play(eid,pid,team) composite key is (eid,pid) Plays(pid, team, matchName, scores) composite key is (pid, team, matchName) Emp(empID, dob, salary) empID is pk Players(pid, name, team) composite keys are (pid, team)
The query that I wrote is this however I get an error because im using group by operator. Is there an alternate way that can work? Also Im not sure if im during the join right? I am not able to use the where clause as where name = ‘Jack’. It tells me ‘no column named Jack ‘
Select name, address, dob, sum(scores) From Emp e JOIN Emp_Players ep ON e.empID = ep.eid JOIN Plays p ON p.pid = ep.pid Group by p.pid;
I would really appreciate any help. Thanks.