Join operation pdf
Join operation pdf
A Join operation combines related tuples from diferent relations, if and only
if a given join condition is satisfedd It is denoted by ⋈d
Example:
EMPLOYEE
EMP_CODE EMP_NAME
101 Stephan
102 Jack
103 Harry
SALARY
EMP_CODE SALARY
101 50000
102 30000
103 25000
Result:
1. Natural Join:
o A natural join is the set of tuples of all combinations in R and S that are equal
on their common attribute namesd
o It is denoted by ⋈d
Example: Let's use the above EMPLOYEE table and SALARY table:
Input:
Output:
EMP_NAME SALARY
Stephan 50000
Jack 30000
Harry 25000
2. Outer Join:
The outer join operation is an extension of the join operationd It is used to
deal with missing informationd
Example:
EMPLOYEE
Input:
(EMPLOYEE ⋈ FACT_WORKERS)
Output:
o It is denoted by ⟕d
Input:
1d EMPLOYEE ⟕ FACT_WORKERS
o It is denoted by ⟖d
Input:
EMPLOYEE ⟖ FACT_WORKERS
Output:
o In full outer join, tuples in R that have no matching tuples in S and tuples in S
that have no matching tuples in R in their common attribute named
o It is denoted by ⟗d
Input:
EMPLOYEE ⟗ FACT_WORKERS
Output:
3. Equi join:
It is also known as an inner joind It is the most common joind It is based on
matched data as per the equality conditiond The equi join uses the
comparison operator(=)d
Example:
CUSTOMER RELATION
CLASS_ID NAME
1 John
2 Harry
3 Jackson
PRODUCT
PRODUCT_ID CITY
1 Delhi
2 Mumbai
3 Noida
Input:
CUSTOMER ⋈ PRODUCT
Output:
1 John 1 Delhi
2 Harry 2 Mumbai
3 Harry 3 Noida