There isare a lot of good answers here with very accurate relational algebra examples. Here is a very simplified answer that might be helpful for amateur or novice coders with SQL coding dilemmas.
Basically, more often than not, queries JOIN boilsqueries boil down to two cases :
For a SELECT of a subset of data A data:
- use
INNER JOINwhen the related dataBdata you are looking for MUST existsexist per database design; - use
LEFT JOINwhen the related dataBdata you are looking for MIGHT or MIGHT NOT existsexist per database design.