Get Started: SQL FULL JOIN

In This Article, You Will Know About SQL FULL JOIN. 

SQL FULL JOIN – Before moving ahead, let’s know a bit about SQL RIGHT JOIN.

Table of Contents

SQL FULL JOIN

The SQL FULL keyword returns all records from both tables. FULL JOIN is also known as FULL OUTER JOIN.

Syntax

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

Example Database

Table name: Data_1

S.No

Name

Class

1

Alex

5

2

Rolex

6

3

Salex

7

4

Jalex

8

5

Kalex

9

Table name: Data_2

S.No

Roll_No

Section_ID

6

451

A

7

452

B

8

453

C

9

454

D

10

455

E

Example: Use the SQL FULL JOIN keyword to return the matching records from both tables.

				
					SELECT Data_1.Name, Data_2.Roll_No
FROM Data_1
FULL OUTER JOIN Data_2
On Data_1.S.No = Data_2.S.No;
				
			

Example: Use the SQL FULL JOIN keyword to return the matching records from both tables ordered by Section_ID.

				
					SELECT Data_1.Name, Data_2.Roll_No
FROM Data_1
FULL OUTER JOIN Data_2
On Data_1.S.No = Data_2.S.No
ORDER BY Data_2.Section_ID;
				
			

If you find anything incorrect in the above-discussed topic and have further questions, please comment below.

Connect on:

2 thoughts on “Get Started: SQL FULL JOIN”

Leave a Comment

Stay in the loop

codingstreets