Joins and Primary | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Joins and Primary

Hello guys, do table joins have any relation with primary key or foreign key?

2nd May 2020, 5:36 PM
Samuel Wekobosya
Samuel Wekobosya - avatar
3 Answers
0
Hi, A JOIN is used to combine rows from two or more tables, based on a related column between them. A primari key is a field(s) in a table which uniquely identifies each row in a table.foreign key is a key used to link two tables together. It is a field (s) in one table that refers to the primari key in another table. In order to join tables is correct match record whith this Key fields. I Hope to answered your question.
2nd May 2020, 7:04 PM
Lasly
Lasly - avatar
0
Thks
3rd May 2020, 8:40 PM
Samuel Wekobosya
Samuel Wekobosya - avatar
0
JOIN is used when you need to mix some columns from several tables under a condition. This specific condition is not defined just by column(s) value, such like conditions defined by WHERE clause. The condition specified in JOIN operation (if I may say so), is defined by the ON specifier which requires the joined tables to have referential integrity. That is, a column in one table (a foreign key) references a column in another table (usually and ideally be a primary key). The condition defined by JOIN operation (with ON specifier), combined with good data relationship design allows deeper qualification for matching records beyond that a WHERE clause can define, because the condition is specified and enforced on the tables to be joined, rather than just on one of the joined tables (by use of WHERE clause). Hth, cmiiw
3rd May 2020, 9:29 PM
Ipang