How can I find suitable join keys between two tables if I have more than one same columns Exists in two tables | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I find suitable join keys between two tables if I have more than one same columns Exists in two tables

How can I find suitable join keys between two tables if I have more than one same columns Exists in two tables .in which we need to analyse the tables

28th Nov 2020, 3:03 AM
vijay
vijay - avatar
2 Answers
+ 2
You need to identify what are the primary and foreign keys in each table https://stackoverflow.com/questions/3362225/describe-table-structure Also it is important if all those tables are properly normalized.. If there is redundant data in the common colums, then a join can produce strange results. https://www.guru99.com/database-normalization.html
28th Nov 2020, 4:02 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Also keep in mind, that even if two tables have colums with the same name, it doesn't mean that they have the same semantic meaning. For example, you may have a students table and a courses table, and each has an id and a name column, but these are not related to each other. Maybe there is a linking table called participants, where student_id and course_id are connected. The best way to navigate these connections, is to look at the entity relationship (ER) diagram. That is usually prepared by the person who designs the database.
28th Nov 2020, 4:09 AM
Tibor Santa
Tibor Santa - avatar