codescracker


sql

SQL Full Outer Join



« Previous Tutorial Next Tutorial »


SQL FULL OUTER JOIN keyword is used to return all the rows from the left table (i.e., table1) and from the right table (i.e., table2).

The FULL OUTER JOIN keyword combines the result of both the SQL LEFT and the SQL RIGHT JOINs.

Here is the general form of the FULL OUTER JOIN keyword in SQL:

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

SQL Demo Database

Let us assume that we have the following two table named "Admissions" and "Students".

sql full join

sql full outer join

SQL FULL OUTER JOIN Example

Here is an example of FULL OUTER JOIN keyword in SQL. The following SQL statement selects all students having the same StudentId present in both the table (here we are going to query the sql statements which will display all the records) :

SELECT admissions.studentID, students.Name, admissions.AdmissionYear, students.address
FROM students
FULL OUTER JOIN admissions
ON students.studentID=admissions.studentID
ORDER BY students.Name;

After querying the above SQL Statements, you will get this output:

sql full join keyword

« Previous Tutorial Next Tutorial »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test