What is the difference between join and union.
Answer Posted / uchit shah
A Union and Join are similar in that they both are combining
two tables to form another table. However they do this
combining in different ways. The geometry is different.
Lets say for Table A and Table B
Union : -
|A|
-
|B|
-
Join : - -
| A | B |
- -
Union :
(1) In Union Two Rows of one table must fit onto the other
table. The Number of columns in the result table is the same
as the number in both tables. No new Columns are added.
(2) Maximum Number of rows = Sum of Number of rows in the
two tables.
Join :
(1) In Join the rows of one table may be different from the
rows of another table. The result table can contain columns
from both the first and second tables. It can contain all
the columns of first table and all the columns of second tables.
(2) Maximum Number of rows = Product of rows in two tables.
| Is This Answer Correct ? | 25 Yes | 3 No |
Post New Answer View All Answers
Can we join same table in sql?
What is the difference between functions, procedures, and packages in pl/sql?
What is the difference between subquery and correlated query?
Can we use view in stored procedure?
Does db2 use sql?
What is program debugging?
Why self join is used in sql?
how to present a past time in hours, minutes and seconds? : Sql dba
What is a sql select statement?
what is foreign key? : Sql dba
Why cross join is used?
Does a join table need a primary key?
Why should I use postgresql?
what is try_catch block in procedure
how to dump a table to a file with 'mysqldump'? : Sql dba