In sql, FULL JOIN returns result-set from both the table in such a way that all the rows for matching condition is returned and at the same time rows for which no match is found it will contain NULL.


Diagrammatic Explanation

full join by tutorialsinhand


Syntax for full join

SELECT column1, column2,...,columnN 
FROM table1 
FULL JOIN table2 
ON table1.column = table2.column;

Example on full join

We will take two tables tih_Courses and Registration as shown below:

Course_ID Course_Name Professor Mode_of_Training
001 .Net Mukesh Tiwari Online and Offline
002 Java Rajneesh Shukla Online and Offline
003 ANSI SQL Rajneesh Shukla Online
004 Basics of Computer Shweta  Online

Course_ID Course_Name Registered_Students Total_Strength
001 .Net 107 120
002 Java 118 130
009 Oracle 100 110
010 Ruby 80 90
Query-1:Select all the course name and registered student to the respective courses.
SELECT tih_Courses.Course_Name, Registration.Registered_Students 
FROM tih_Courses 
FULL JOIN Registration 
ON tih_Courses.Course_ID = Registration.Course_ID;


Please Share this page
Views : 119
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!