There are factors which can be used to determine which is the left or right table once i want to join them in sql ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

There are factors which can be used to determine which is the left or right table once i want to join them in sql ??

Using left join or right join in sql.

17th Jun 2023, 8:29 PM
Erick MM
Erick MM - avatar
3 Answers
+ 3
See these visual representations of LEFT and RIGHT JOINs. https://www.codeproject.com/articles/33052/visual-representation-of-sql-joins This is the best resource I have found to quickly determine how to write a complicated JOIN. I refer to it often.
18th Jun 2023, 1:51 AM
Brian
Brian - avatar
+ 2
Observe that there is symmetry in Venn diagrams. T1 LEFT JOIN T2 is exactly the same as T2 RIGHT JOIN T1 Both of these mean that all lines of T1 are kept, and only the matching lines from T2 are combined to it. For this reason I hardly ever use right join, because for me it makes a clearer mental path to add extra information from left to right.
18th Jun 2023, 6:00 AM
Tibor Santa
Tibor Santa - avatar
+ 1
Ndungu yangu ErickMM no yako ndungu yangu
18th Jun 2023, 3:59 PM
Juma Selemani Tamra
Juma Selemani Tamra - avatar