...

Database Managment - MySql

Back to Course

Lesson Description


Lession - #1337 SQL Full Join



FULL JOIN:  

Consider the two tables below:
Student
Sorry cannot be displayed

StudentCourse
Sorry cannot be displayed


The result-set of FULL JOIN is created by combining the results of both LEFT JOIN and RIGHT JOIN. All of the rows from both tables will be included in the result-set. The result-set will contain NULL values for the rows for which there is no match.

Syntax:

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


table1: First table.
table2: Second table
matching_column: Column common to both the tables.


Note that instead of using RIGHT JOIN, we can use RIGHT OUTER JOIN.

Sorry cannot be displayed
Example Queries(FULL JOIN>
:


SELECT Student.NAME,StudentCourse.COURSE_ID 
FROM Student
FULL JOIN StudentCourse 
ON StudentCourse.ROLL_NO = Student.ROLL_NO;


Output:

Sorry cannot be displayed