What is the difference between union and join

Following are the differences between union and join in relational database engines.
A union returns the results of two different queries as a single recordset and A join allows you to relate similar data in different tables.

UNION JOIN
UNION puts lines from queries after each other, JOIN makes a cartesian product and subsets it
Union Operation is combined result of the Vertical Aggregate of the rows JOIN Operation is combined result of the Horizontal Aggregate of the Columns
Union combines rows JOIN links the rows
Performed only on two similar structures Performed only on two dissimilar structures also
A union returns the results of two different queries as a single recordset. A join allows you to relate similar data in different tables.

Visual depiction of a join. Table A and B’s columns are combined into a single result:

Continue reading What is the difference between union and join