0

Suppose that schema T is a weak entity that is weakly related to S. This means that all rows of T must participate in the relationship.

Does this mean I have to use something to the effect of T outer left join S or should it be S outer left join T? I'm thinking it might be the first option, since this will essentially force all rows of T to be present.

But I'm also getting confused by this:

  1. Wouldn't this mean there will be missing rows in S for those that doesn't match the rows in T? Isn't S supposed to be the dominant entity?

  2. Also, if we choose the first option, since T is weakly related to S, wouldn't this cause T outer left join S to be to the effect of an inner join, since all attributes of T will lead to an existing entry in S?

On the other hand, if I use S outer left join T, this seems correct as well as there wouldn't be rows of T that has empty S values, since T rows cannot exist without S values.

Hope to clarify my misconceptions about this topic.

oldselflearner1959
  • 633
  • 1
  • 5
  • 22
  • You usually do left joins, because that's how the human brain works. – jarlh Jan 11 '18 at 22:20
  • if T rows cannot exist without S value then you sould use inner join, see [here](https://stackoverflow.com/questions/38549/what-is-the-difference-between-inner-join-and-outer-join?rq=1) – Hollyol Jan 11 '18 at 22:24
  • In that case, when is outer join appropriate? – oldselflearner1959 Jan 11 '18 at 22:38
  • outer join is used when you also need data from the second table independently from conditions on the first table, or if the second table have null entries that should be present in the result – Hollyol Jan 11 '18 at 23:04
  • 2
    In some cases it can be faster to do left join instead of inner join @Hollyol. In the end you use inner join if you want to make sure, that a row in another table linked with your result is present. – Demigod Jan 11 '18 at 23:16

0 Answers0