Semi Join with Examples in Relational Algebra, Database Systems

Semi-Join with Examples in Relational Algebra (Database Systems)

Today, in this fresh and new article, we will cover the following topics;

  1. What is Semi Join?
  2. Examples of Semi Join

What is Semi Join?

Semi-Join matches the rows of two relations and then show the matching rows of the relation whose name is mentioned to the left side of ⋉ Semi Join operator. I am describing the more details in the below examples. Hopefully, it will help you to understand the semi-join.

Example 1 of Semi Join

ID Rank Salary
101 Assistant Professor 80,000
102 Associate Professor 90,000
103 Lecturer 70,000

Table 1: Teacher

ID RollNo Marks
103 2017 – 01 80
104 2017 – 02 90
105 2017 – 03 70

Table 2: Student

ID RollNo Marks
103 2017 – 01 80

Table 3: Student ⋉ Teacher OR Student Semi Join Teacher

ID Rank Salary
103 Lecturer 70,000

Table 4: Teacher ⋉ Student OR Teacher SEMI-JOIN Student

Example 2 of Semi Join

 

ID Rank Salary
101 Assistant Professor 80,000
102 Associate Professor 90,000
103 Lecturer 70,000

Table 5: Teacher

ID RollNo Marks
101 2017 – 01 80
103 2017 – 02 90
106 2017 – 03 70

Table 6: Student

ID RollNo Marks
101 2017 – 01 80
103 2017 – 02 90

Table 7: Student ⋉ Teacher OR Student SEMI-JOIN Teacher:

 

ID Rank Salary
101 Assistant Professor 80,000
103 Lecturer 70,000

Table 8: Teacher ⋉ Student OR Teacher SEMI-JOIN Student

Example 3 of Semi Join

Employee
Name EmpId DeptName
Sameed 1 CS
Shahzeb 2 SE
Abid 3 CS
Shamil 4 IT
Department
DeptName Manager
SE Shahzeb
IT Shamil
Employee  Dept
Name EmpId DeptName
Shahzeb 2 SE
Shamil 4 IT

 

Topic Covered

Semi-Join with Examples in Relational Algebra, Database Systems.