Skip to content
Related Articles

Related Articles

Improve Article
Difference between Natural join and Cross join in SQL
  • Difficulty Level : Medium
  • Last Updated : 03 May, 2020

1. Natural Join :
Natural Join joins two tables based on same attribute name and datatypes. The resulting table will contain all the attributes of both the tables but only one copy of each common column.

Example:
Consider the two tables given below:

Student Table



Marks Table

Consider the given query



SELECT * 
FROM Student S NATURAL JOIN Marks M;

Output :



2. Cross Join :
Cross Join will produce cross or Cartesian product of two tables if there is no condition specifies. The resulting table will contain all the attributes of both the tables including duplicate or common columns also.

Example:
Consider the above two tables and the query is given below:

SELECT * 
FROM Student S CROSS JOIN Marks M; 

Output:



Difference between Natural JOIN and CROSS JOIN in SQL

SR.NO.NATURAL JOINCROSS JOIN
1.Natural Join joins two tables based on same attribute name and datatypes.Cross Join will produce cross or cartesian product of two tables .
2.In Natural Join, The resulting table will contain all the attributes of both the tables but keep only one copy of each common columnIn Cross Join, The resulting table will contain all the attribute of both the tables including duplicate columns also
3.In Natural Join, If there is no condition specifies then it returns the rows based on the common columnIn Cross Join, If there is no condition specifies then it returns all possible pairing of rows from both the tables whether they are matched or unmatched
4.SYNTAX:
SELECT * FROM table1 NATURAL JOIN table2;
SYNTAX:
SELECT * FROM table1 CROSS JOIN table2;

Attention reader! Don’t stop learning now. Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :