SQL Full Join

SQL Full Join return all records from both tables.

Syntax


SELECT column_name(s) FROM table1
FULL OUTER JOIN table2
ON table1.column_name = table2.column_name
WHERE condition;

Take a table Student:

StudentID StudentName City
15 Rahul Pathankot
16 Karan Pathankot
17 Ajay Pathankot
18 Rocky Pathankot


Now, Take another table Fees

FeesID StudentID StudentName Fees
1 15 Rahul 800
2 16 Karan 800
3 17 Ajay 800


Query




SELECT StudentID.Student, FeesID.Fees FROM Student
FULL JOIN Fees ON StudentID.Student=StudentID.Fees;



Output

FeesID StudentID
1 15
2 16
3 17
NULL 18

Back To Top