Wednesday, November 9, 2022

What is Difference between Cross join and Full Join in SQL?

 Cross Join:-

CROSS JOIN is also known as the Cartesian product / Cartesian join.

Cross join defines where the number of rows in the first table multiplied by a number of rows in the second table.

Cross Join applies to all columns.


Syntax:

Select * from TableName1

cross join TableName2 ;

Query:

Select * from Table_1

cross join Table_2 ;


Full outer join:


FULL OUTER JOIN combines the results of both left and right outer joins and returns all matched or unmatched rows from the tables on both sides of the join clause.


Syntax:

SELECT *FROM table_1

FULL OUTER JOIN table_2

ON table_1.ColumnName=table_2.ColumnName;


https://medium.com/@patilpoojaif/difference-between-cross-join-vs-full-outer-join-in-sql-server-a882dfc7a3d3

No comments:

Post a Comment

How to use SQL pagination using LIMIT and OFFSET

  How to extract just a portion of a larger result set from a SQL SELECT. LIMIT n is an alternative syntax to the FETCH FIRST n ROWS ONLY. T...