top | item 30818762

(no title)

tibiapejagala | 3 years ago

I sometimes use left join to protect me against errors somewhere else.

Let’s say you do an inner join in insert into … select statement to find some other entity which 100% should be there. If something else is screwed up you might silently filtering out rows. With left join you keep everything, but not null constraint on the table protects you and turns it into an explicit error.

discuss

order

Moru|3 years ago

Yes, have seen this a number of times. Convert to left join and some sanity checks and everything works again. I'm also one of those that mostly use left joins, not sure what the article is on about :-) The other joins have their uses but most of the time it's lefties.