What is the difference between join and union | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What is the difference between join and union

if both join and union is used to combine the data then what is the difference between both of them.

29th Aug 2018, 8:19 PM
Husna Kowser
Husna Kowser - avatar
3 Answers
+ 13
JOIN combines two tables "horizontally", while UNION glues them together "vertically". Since data is usually organized in a way that a row represents one record and columns represent its features, you use JOIN when you want to enrich the records and UNION when you want to stack them together "on top" of each other (perhaps with different set of queries?): Refer to the lessons for more info: https://www.sololearn.com/learn/SQL/1866/ https://www.sololearn.com/learn/SQL/1867/
29th Aug 2018, 8:54 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
got it, thank you
29th Aug 2018, 9:11 PM
Husna Kowser
Husna Kowser - avatar
0
Union is a combination of two tables but Join is a creation of virtual table content the select cases
1st Oct 2018, 4:45 PM
Adel