Level 1: Bronze
A memorized definition. Not wrong, but it stops there.
INNER is the intersection and LEFT takes everything from the left.
2 stars Asked often.
In one or two sentences
INNER JOIN keeps only rows with a match on both sides. LEFT JOIN keeps every left row and fills right columns with NULL when there is no match.
Say it out loud, or type it below. What you type never leaves this device.
A memorized definition. Not wrong, but it stops there.
INNER is the intersection and LEFT takes everything from the left.
Correct, but too broad or missing context.
INNER JOIN returns only rows that have a match. LEFT JOIN returns every row of the left table, with NULL in the right columns where nothing matches.
Reaches principle, use and trade-off, with words that invite the next question.
If you put a condition on the right table in WHERE after a LEFT JOIN, the NULL rows are filtered out and it behaves like an INNER JOIN. Put that condition in ON instead. To find rows with no match, LEFT JOIN and then keep rows where the right key is NULL. When one row matches many rows, result rows multiply and sums can inflate, so check one to many relationships before aggregating. The join method itself is chosen by the optimizer and depends heavily on indexes.
These are likely next questions from an interviewer. Think of your answer first, then press the button.
1 / 3
Why is a right table condition in WHERE a problem with LEFT JOIN?
For unmatched rows the right columns are NULL, so the condition is not true and those rows vanish, which cancels the point of a LEFT JOIN.
2 / 3
Why can totals inflate after a join?
In a one to many relationship one row appears several times, so its value is added several times. Aggregate first or check the relationship.
3 / 3
Which join algorithms exist?
Nested loop, hash join and merge join. The optimizer picks one from data size and indexes.