What is the difference between INNER JOIN and LEFT JOIN in SQL?
An inner join returns only rows where the condition matched on both sides. A left join returns every row from the left table regardless, filling the right side with nulls where nothing matched. That difference in null handling is what makes one or the other correct for a given question.
The distinction becomes concrete with an example. Joining customers to orders with an inner join answers which customers have placed orders, and customers with none simply do not appear. The same join written as a left join answers the different question of what every customer has ordered, with the order-less ones present and empty. Neither is more correct in general; they answer different questions, and choosing by habit rather than intent is a common source of quietly wrong reports.
The most frequent bug is a left join silently converted back into an inner join by the filter clause. Filtering on a column from the right table excludes the null rows the left join just produced, because a null fails almost any comparison. The result looks like it preserves unmatched rows but does not. When the filter is meant to apply only to the join, it belongs in the join condition rather than the filter clause.
Counting is the other reliable trap. Counting all rows in a left join includes the unmatched ones, since the row exists even though the right side is empty. Counting a specific column from the right table skips nulls, which is usually what was actually wanted.
Right joins exist and are the mirror image, but are rare in practice because reordering the tables and using a left join reads more naturally. Full outer joins keep unmatched rows from both sides and are genuinely useful when reconciling two datasets against each other.