Skip to main content
improved language
Source Link
philipxy
  • 15.2k
  • 6
  • 44
  • 101

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 JOIN when the related data B data you are looking for MUST existsexist per database design;
  • use LEFT JOIN when the related data B data you are looking for MIGHT or MIGHT NOT existsexist per database design.

There is 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 boils down to two cases  :

For a SELECT subset of data A :

  • use INNER JOIN when the related data B you are looking for MUST exists per database design;
  • use LEFT JOIN when the related data B you are looking for MIGHT or MIGHT NOT exists per database design.

There are 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, JOIN queries boil down to two cases:

For a SELECT of a subset of A data:

  • use INNER JOIN when the related B data you are looking for MUST exist per database design;
  • use LEFT JOIN when the related B data you are looking for MIGHT or MIGHT NOT exist per database design.
Spelling
Source Link
ForguesR
  • 3.6k
  • 1
  • 20
  • 41

There is 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 boils down to two cases :

For a SELECT subset of data A :

  • use INNER JOIN when the related data B you are looking formfor MUST exists per database design;
  • use LEFT JOIN when the related data B you are looking for MIGHT or MIGHT NOT exists per database design.

There is 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 boils down to two cases :

For a subset of data A :

  • use INNER JOIN when the related data B you are looking form MUST exists per database design;
  • use LEFT JOIN when the related data B you are looking for MIGHT or MIGHT NOT exists per database design.

There is 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 boils down to two cases :

For a SELECT subset of data A :

  • use INNER JOIN when the related data B you are looking for MUST exists per database design;
  • use LEFT JOIN when the related data B you are looking for MIGHT or MIGHT NOT exists per database design.
Source Link
ForguesR
  • 3.6k
  • 1
  • 20
  • 41

There is 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 boils down to two cases :

For a subset of data A :

  • use INNER JOIN when the related data B you are looking form MUST exists per database design;
  • use LEFT JOIN when the related data B you are looking for MIGHT or MIGHT NOT exists per database design.