Syntax : SELECT Column_Name From Table_Name1 INNER JOIN Table_Name2 ON Table_Name1.Column_Name = Table_Name2.Column_Name; |
For Example : Consider two tables student_details and student_result.
Table : student_details
Table : student_result
Query : SELECT * From student_details INNER JOIN student_result Where student_details.Roll_No = student_result.Roll_No; |
Syntax : SELECT Column_Name From Table_Name1 NATURAL JOIN Table_Name2; |
Query : SELECT * From student_details NATURAL JOIN student_result; |
Output
Syntax : SELECT Column_Name From Table_Name1 LEFT JOIN Table_Name2 ON Table_Name1.Column_Name = Table_Name2.Column_Name; |
For Example : Consider the tables student_details and student_result. Now, if we want to implement left outer join on these relations, the result will look like:
Query : SELECT Roll_No, Name, Address, Subject, Marks From Student_Details LEFT OUTER JOIN Student_Result ON Student_Details.Roll_No = Student_Result.Roll_No; |
Syntax : SELECT Column_Name From Table_Name1 RIGHT JOIN Table_Name2 ON Table_Name1.Column_Name = Table_Name2.Column_Name; |
For Example : Consider the tables Student_Details and Student_Result. Now, if we want to implement right outer join on these relations, the result will look like:
Query : SELECT Roll_No, Name, Address, Subject, Marks From Student_Details RIGHT OUTER JOIN Student_Result ON Student_Details.Roll_No = Student_Result.Roll_No; |
Syntax : SELECT Column_Name From Table_Name1 FULL OUTER JOIN Table_Name2 ON Table_Name1.Column_Name = Table_Name2.Column_Name; |
For example : Consider the tables Student_Details and Student_Result. Now, if we want to implement full outer join on these relations, the result will look like:
Query : SELECT Roll_No, Name, Address, Subject, Marks From Student_Details FULL OUTER JOIN Student_Result ON Student_Details.Roll_No = Student_Result.Roll_No; |
NOTE : In the above description of various joins, some symbols are used in the screenshots of examples. They all have some certain meaning.