1. UNION combines the result set of two or more select queries into a single result set which includes all the rows from all the queries in the UNION, where as JOIN retrieves data from two or more tables based on logical relationships between the tables.
2. In short, UNION combines rows from 2 or more tables, where JOIN combines columns from 2 or more tables.
+1
Nigel FernandesRank #753 · 3.1K reputationPosted Feb 9, 2016, 9:59 PM EST
0
In simple terms:
UNION combines rows from two or more tables
JOIN Combines columns from two or more tables
0
Rajeev PunhaniRank #551 · 4.4K reputationPosted Feb 11, 2016, 9:14 AM EST
0
Hi Sandeep,
UNION combines the results of two or more queries into a single result set that includes all the rows that belong to all queries in the union.
By using JOINs, you can 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.
If the above solution is helpful then,accept the answer.
0
Rajeesh MenothRank #118 · 18.4K reputationPosted Feb 11, 2016, 5:24 PM EST
0
Hi,
joins combine data into new columns. If two tables are joined together, then the data from the first table is shown in one set of column alongside the second table’s column in the same row.
Unions combine data into new rows. If two tables are “unioned” together, then the data from the first table is in one set of rows, and the data from the second table in another set. The rows are in the same result.
Raja TRank #685 · 3.5K reputationPosted Feb 5, 2016, 2:30 AM EST
The UNION operator is used to combine the result-set of two or more SELECT statements.
Nigel FernandesRank #753 · 3.1K reputationPosted Feb 9, 2016, 9:59 PM EST
Rajeev PunhaniRank #551 · 4.4K reputationPosted Feb 11, 2016, 9:14 AM EST
If the above solution is helpful then,accept the answer.
Rajeesh MenothRank #118 · 18.4K reputationPosted Feb 11, 2016, 5:24 PM EST
joins combine data into new columns. If two tables are joined together, then the data from the first table is shown in one set of column alongside the second table’s column in the same row.
Unions combine data into new rows. If two tables are “unioned” together, then the data from the first table is in one set of rows, and the data from the second table in another set. The rows are in the same result.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts