+ 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.
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/
+ 2
got it, thank you
0
Union is a combination of two tables but Join is a creation of virtual table content the select cases