SQL Full Join - All you need to get started! With Examples

Hey, folks! In this article, we will be focusing on SQL Full Join in detail.

As seen in our previous posts, SQL Joins enable us to associate the data values from different columns together on the basis of a predefined condition.

Today, we will be having a look at Full Join.

So, let us begin!!


Understanding SQL Full Join

Full Join enables the database administrator to combine the data records of a couple of tables altogether in accordance to a specified condition.

FULL-JOIN

FULL JOIN

In a Full Join, all the matching records are returned from both the tables i.e. the right and left tables. Thus, Full Join is considered as a combination of the properties of Left Join and Right Join, respectively.

Having understood the working of Full Join, let us now focus on the structure in the upcoming section.


Syntax of Full Join in SQL

Have a look at the below syntax!

From the above command, the following values are returned–

  • All the matching data records from left as well as right table of the database.
  • If any record of the either table(left or right) does not matches the other records, it displays a NULL value.

Thus, it is a summation of the Left Join and Right Join.


Implementing Full Join in SQL

NOTE: MYSQL does not support full join. Instead, the SQL UNION ALL clause is used to perform the operation of Full join as shown in the below example.

Initially, we have created two tables ‘Stud_Info’ and “Stud_score’ using SQL Create and Insert query to display the data of a group of students.

Table-2 Stud_score

Now, let us apply the concept of Full Join on the above tables as shown–

Output:

SQL-FULL-JOIN-1024x430


Conclusion

By this, we have come to the end of this topic. Feel free to comment below, in case you come across any question.

Till then, Happy Learning!!


References

By admin

Leave a Reply

%d bloggers like this: