The SELF Join is a regular join, but the table is joined with itself.

SYNTAX:

Where,

  • SELF JOIN                                   :  keyword used for joining a table with itself.

  • Table_name1/Table_name2        :The name of the table from where you want to fetch the data

  • Colume_Names                           :The name of the columns of the table based on which you want to join.

 
 

EXAMPLE

Let us consider a demo database with table Salary. Following is the structure of the table:

Figure 36.1. SALARY TABLE

The following SQL statement shows Self Join

Figure 36.2. SELF JOIN QUERY OUTPUT

 

PRACTICE YOURSELF

©2020 by Pavan Lalwani. 

  • Udemy
  • Facebook
  • Twitter
  • YouTube
  • Linkedin