Here are how the four types of joins will behave against these two database tables. First off, I got a surprise when it turned out the ambiguous join wherein only the world join is specified like so...
SELECT *
FROM LowercaseLetters AS l
JOIN UppercaseLetters AS u
ON l.LowerId = u.UpperId
...behaved not like a left join as I expected here, but like an inner join. It did the same thing as this:
SELECT *
FROM LowercaseLetters AS l
INNER JOIN UppercaseLetters AS u
ON l.LowerId = u.UpperId
The left join looks like so in contrast:
SELECT *
FROM LowercaseLetters AS l
LEFT JOIN UppercaseLetters AS u
ON l.LowerId = u.UpperId
The super magic amazing right join looks like this:
SELECT *
FROM LowercaseLetters AS l
RIGHT JOIN UppercaseLetters AS u
ON l.LowerId = u.UpperId
The cross join returns 169 rows!
SELECT *
FROM LowercaseLetters AS l
CROSS JOIN UppercaseLetters AS u
No comments:
Post a Comment