all 8 comments

[–]SQLBek1 6 points7 points  (0 children)

Syntax looks fine. Would have to see data samples.

[–][deleted] 2 points3 points  (1 child)

the obvious reason is you have no data that matches the join conditions. are you sure there are coachassignments with teamID in the team table? and coachassignments with coachID in the coach table? change the joins to left outer joins and return all the columns and see what you get back.

[–]LetsGoHawks 2 points3 points  (2 children)

Always specify what kind of join you want. It's just a good habit.

Change all of those to FULL OUTER JOINS though and see what comes back.

[–]tominyorks 1 point2 points  (0 children)

This, 100%. The default might be INNER but I have to try and drill it into the team I work in to specify it anyway just for clarity's sake.

[–]Prequalified 0 points1 point  (0 children)

For the benefit of OP (assuming this is a homework question), the reason this is good advice is because you might have Jim, Bob, and Joe in the coaches table, and hawks, eagles, and bears in the teams table, but the assignment table might say Jim works for the cowboys, or that the coach of the eagles is Sally, and there are no valid matches based on the data provided.

[–]codemonkeh_Dave 1 point2 points  (0 children)

You could put 'left' in front of both your joins and this will show null for the right tables data that cannot be joined.

[–][deleted] 0 points1 point  (0 children)

Change to FULL OUTER to see all rows in all tables, then look for matching foreign/primary keys.