SQL Outer-Join Clause

Tips>>SQL

MAKE FULL WEB APPLICATION WITH JUST SQL KNOWLEDGE? CLICK HERE

 

Outer join is essential to display all the records from one table and some from another it is called outer join. In inner join or equal join a matching common value is checked in both the tables for equality. In outer join, it picks all the records from one table and take only the matching records from another table, displaying NULL from non-matching values. The outer join is only possible between two tables. There are two types of outer join namely left and right.

EXAMPLE#I :-

We have a table called Name with two fields (Grade and name).
It contains the following data :-

GRADE
NAME OF STUDENT
A
Nirav Thakkar
B
Mihir Verma
C
Dhruv Shah
D
Parin Sheth

 

We have a second table called Percentage with three fields (Grade, Marks, and percentage).
It contains the following data :-

GRADE
MARKS
PERCENTAGE
A
780
75.87%
B
654
63.89%

 

If we ran the SQL statement below :-

Select Name .Grade, student_name, percentage.Grade,
Marks, percentage
where Name of student_ Grade= Marks_Percentage;

 

Our RESULT set would look like this :-

NAME OF STUDENT
GRADE
MARKS
PERCENTAGE
Nirav Thakkar
A
780
75.87%
Mihir Verma
B
654
63.89%
Dhruv Shah
C
<null>
<null>
Parin Sheth
D
<null>
<null>

 

If you don't find what you are looking for. Please click here to submit your query, our experts will reply soon.

 
E-mail : sales@virtualsplat.com
Phone : +91-9892413501

Whatsapp Icon +91-9967648641

Whatsapp Icon +91-9967648641