FULL JOIN
In SQL, FULL JOIN is used to fetch all the records from both tables. If there is no matches in one of the table then its return the NULL value.
Syntax
SELECT column_name(s)
FROM table_nameA
FULL JOIN table_nameB ON table_nameA.column_name = table_nameB.column_name;
Example:
Let us take three tables named Geeks1, Geeks2, and Geeks3.
Geeks1 Table:
Geeks2 Table:
Geeks3 Table:
Example to select the records from multiple tables:
Query
SELECT Geeks3.GID, Geeks3.PID,
Geeks3.Asset, Geeks1.FirstName,
Geeks2.LastName
FROM Geeks3
LEFT JOIN Geeks1
ON Geeks3.GID = Geeks1.ID
LEFT JOIN Geeks2
ON Geeks3.GID = Geeks2.ID
Output
SELECT data from Multiple Tables in SQL
The statement is used to retrieve the fields from multiple tables and with the help of JOIN operations we easily fetch the records from multiple tables, Generally JOINS are used when there are common records between two tables. In this article, we will look into various types of JOIN that are used in SQL.