190 likes | 316 Views
The Inner Join and Outer Joins. Dec 15 2004. Dancing and Tennis. Dancing only. Tennis Only. The Whole Picture. A. B,D,F. C. G. The Inner Join. B,D,F. Inner. The Left Outer Join. A. B,D,F. G. Left. Inner. The Right Outer Join. B,D,F. C. Right. Inner. The Full Outer Join.
E N D
The Inner Join and Outer Joins Dec 15 2004
Dancing and Tennis Dancing only Tennis Only The Whole Picture A B,D,F C G
The Inner Join B,D,F Inner
The Left Outer Join A B,D,F G Left Inner
The Right Outer Join B,D,F C Right Inner
The Full Outer Join A B,D,F C G Right Left Inner
The Exclusive Join A C G Right Left
Using Plausible Keys To link The tables together …. dance ____ JOIN tennis ON dance.scode=tennis.scode
The Inner Join SELECT * FROM dance inner join tennis On dance.scode=tennis.scode B,D,F Inner
The Left Outer Join SELECT * FROM dance left outer join tennis On dance.scode=tennis.scode A B,D,F G Left Inner
The Right Outer Join SELECT * FROM dance right outer join tennis On dance.scode=tennis.scode B,D,F C Inner Right
The Full Outer Join SELECT * FROM dance full outer join tennis On dance.scode=tennis.scode A B,D,F C G Left Inner Right
The Exclusive Join SELECT * FROM dance full outer join tennis On dance.scode=tennis.scode Where dance.scode is .null. Or tennis.scode is .null. A C G Left Right
Court1 Court2 3:30 – 4:00 Session A 4:00 – 4:30 Session B
Keys for Sessions:udate+session court1____ JOIN court2 ON court1.udate=court2.udate and court1.session=court2.session ….. Using Plausible Keys To link The tables together
Keys for Days:udate court1____ JOIN court2 ON court1.udate=court2.udate session ….. Using Plausible Keys To link The tables together Group By