Join Behaviour on Duplicates & NULL

 

 A screenshot of a computer

AI-generated content may be incorrect.               A screenshot of a computer

AI-generated content may be incorrect.                

 

Inner Join Result with Duplicate–

A screenshot of a computer

AI-generated content may be incorrect.

 

Left Outer Join with Duplicate-

 

 

 

Right Outer Join with Duplicate

A screenshot of a computer

AI-generated content may be incorrect.

 

Joins with NULL : NULL  cannot be used in Join, is we can not join anything with NULL , even NULL can not join with NULL.

             A screenshot of a computer program

AI-generated content may be incorrect.

No Change in Inner Join –

A screenshot of a computer

AI-generated content may be incorrect.

Left Outer Join –

A screenshot of a computer

AI-generated content may be incorrect.

Here in result record no 5 has NULL from t1 but another NULL is comonig as there is no match.

Right Outer Join –

Here in result record no 5 has NULL values but this null value is not the one which is stored in T1. This is because C1 column from T2 table having value 4 is not matching with any of the records in T2.


Let’s check the FULL OUTER JOIN –

 

Another Example Holding NULL in both tables –

 A screenshot of a computer

AI-generated content may be incorrect.

Inner Join –here NULL is not shown in the result even though it is matching

A screenshot of a computer

AI-generated content may be incorrect.

 

 

This can be handled using NVL function –

A screenshot of a computer

AI-generated content may be incorrect.

Left Outer Join –

Right Outer Join –

A screenshot of a computer

AI-generated content may be incorrect.

Full Outer Join –

 

A screenshot of a computer

AI-generated content may be incorrect.

 

Now how to handle this ? Since here join has some issue and giving multiple records .

Using NVL –

A screenshot of a computer

AI-generated content may be incorrect.

 

 

No comments:

Post a Comment

About This Blog

SQL and PL/SQL are essential for database management, enabling efficient data retrieval, manipulation, and transaction control. SQL (Structu...