Difference between full join and cross join-oracle sql plsql interview question and answer for fresher and experienced
Difference between full join and cross join in sql:-
CROSS JOIN |
FULL JOIN |
It combines
each and every row from one table with another table. Specific condition or
relationship is not required to match all the rows of two tables. It will
generate possibility all the combination of rows. The number of rows present
in the first table are multiplied with the number of rows present in the second
table. |
It combines
rows from the two tables when there is matched on the basis of specified
condition and includes unmatched rows from the both tables with NULL values. |
It is known
as cartesian product or cartesian join. |
It is known
as full outer join. |
ON clause is
not present. |
ON clause is present.
On condition is not satisfied for those rows, it will placed NULL values for
unpopulated fields. |
It will
produce all the combinations of the rows. |
It is the
combination of left outer join and right outer join. It doesn’t generate all
the possible combination like cross join. |
Syntax: Select * from
table1 CROSS JOIN
table2 CROSS JOIN
table3; |
Syntax: Select * from
table1 FULL OUTER
JOIN table2 On table1.comm_column_name=table2.comm_column_name; |
If two tables
A & B are present and B is empty, then A*B=A*0=0 |
If two tables
A & B are present and A& B are empty, then A*B=0*0=0.Otherwise,it
will carry the value of the non-empty table. |
If two joined
tables contain C & D rows, it will produce C*D. |
If two joined
tables contain C & D rows, it will produce C+D. |
Table D
contain 20 rows and Table E contain 30 rows,10 rows are matching on specified
columns, then result will be 20*30=600 |
Table D
contain 20 rows and Table E contain 30 rows,10 rows are matching on specified
columns, then result will be 10+10+20=40 |
Result set
will be greater than equal to full outer join. |
Result set
will be less than equal to cross join. |
Comments
Post a Comment