Having problems joining table I have the following tables and I want to know Jack's dob, salary and the total score of that employee who is also a player.
The relational schemas are:


Emp_Players (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 I'm using group by operator.
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;

Is there an alternate way that can work? Also I'm not sure if I'm doing the JOIN right? I am not able to use the where clause as where name = 'Jack'. It tells me

'no column named Jack'

I would really appreciate any help. Thanks.
When you use the GROUP BY clause, you can only select the fields you group on, or aggregate functions on top of ungrouped fields, like so for example:
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, name, address, dob

This will give you the sum of the scores for that player (pid) as you want if they only have one name, address, and dob per pid. But if they have two addresses for example, you'll see two records for that pid, one for each address, with the score summed for just that address. (I assume that's not the case here but just so you're aware. I was unsure since the schema you provided is incomplete and doesn't mention address.)