And, just for general reference, an INNER JOIN can be coded without the JOIN keyword. These two queries are equivalent:
Code:
SELECT
TS.StaffKey,
TS.StaffName,
TK.KidKey,
TK.Kidname
FROM
tblStaffnames AS TS
INNER JOIN
tblStaffkids AS TK
ON TS.StaffKey = TK.KidParent;
SELECT
TS.StaffKey,
TS.StaffName,
TK.KidKey,
TK.Kidname
FROM
tblStaffnames AS TS,
tblStaffkids AS TK
WHERE
TS.StaffKey = TK.KidParent;
StaffKey StaffName KidKey KidName
1 George Hamilton 102 Whoopi
2 Linda Smith 100 Jamie
2 Linda Smith 101 Kate
4 Ernest Borgnine 104 Ernie
The INNER JOIN syntax is preferred, since it is more explicit, and since the JOIN fields can't accidentally get lost inside a complicated selection criteria.
If that happens, and someone deletes that join condition from the WHERE, you end up with a CROSS JOIN like this:
Code:
SELECT
TS.StaffKey,
TS.StaffName,
TK.KidKey,
TK.Kidname
FROM
tblStaffnames AS TS,
tblStaffkids AS TK;
StaffKey StaffName KidKey KidName
1 George Hamilton 100 Jamie
1 George Hamilton 101 Kate
1 George Hamilton 102 Whoopi
1 George Hamilton 104 Ernie
2 Linda Smith 100 Jamie
2 Linda Smith 101 Kate
2 Linda Smith 102 Whoopi
2 Linda Smith 104 Ernie
3 Babe Ruth 100 Jamie
3 Babe Ruth 101 Kate
3 Babe Ruth 102 Whoopi
3 Babe Ruth 104 Ernie
4 Ernest Borgnine 100 Jamie
4 Ernest Borgnine 101 Kate
4 Ernest Borgnine 102 Whoopi
4 Ernest Borgnine 104 Ernie
5 Jane Doe 100 Jamie
5 Jane Doe 101 Kate
5 Jane Doe 102 Whoopi
5 Jane Doe 104 Ernie
For a parent/kid database, a cross join doesn't have any meaning. On the other hand, a cross join might be useful for some other combination of tables. Say, if you wanted a checklist to make sure that every coach had spent one-on-one time with every player on the team.