What's main difference btwn union and join?
UNION combines results of two or more queries into a single result set that includes all the rows that belong to all queries in the union. JOINs retrieve data from two or more tables based on logical relationships between the tables. Joins indicate how SQL should use data from one table to select the rows in another table.
union increases no of rows join increases no of columns
What many SoloLearn users are doing is searching "join vs union" on the Internet and posting that as part of their answer. I am going to respect authors or bloggers response and I am going to provide you two links that is going to take you to the concepts and examples, step-by-step in what is a "join" and what is an "union". At the end you will have your own understanding and conclusion what is a join vs union. http://www.w3schools.com/sql/sql_join.asp http://www.w3schools.com/sql/sql_union.asp
In Sql, joins mean combining data from two or more table creates temporary joining .Join is done on 2 different table of same database having same colomn name.
Unions stack results vertically. The data type of every column must match, but the values don't have to match. Joins display results horizontally, but only need a single matching point of data. edit: I like the down votes for giving an accurate explanation. /s
UNION does include records from two or more queries, however it will only show DISTINCT values. UNION ALL will show all records from the queries.