The Relational Algebra


Download 244.7 Kb.
Pdf ko'rish
bet6/15
Sana08.01.2022
Hajmi244.7 Kb.
#251390
1   2   3   4   5   6   7   8   9   ...   15
Bog'liq
Relat Alg1

SELECT 

E.Fname AS First_name, E.Lname AS Last_name, E.Salary AS 

Salary 


FROM 

EMPLOYEE AS 



WHERE 

E.Dno=5, 

 

 

Relational Algebra Operations from Set Theory 





 

The UNION, INTERSECTION, and MINUS Operations 

The next group of relational algebra operations are the standard 

mathematical operations on sets.  

 

For example, to retrieve the Social Security numbers of all 



employees who either work in department 5 or directly supervise an 

employee who works in department 5, we can use the UNION operation as  

follows: 

 

RESULT1 



←π

Ssn


(DEP5_EMPS) 

RESULT2


←π

Super_ssn

(DEP5_EMPS) 

RESULT 


←RESULT1 ∪ RESULT2 

 

The relation RESULT1 has the Ssn of all employees who work in 



department 5,  

 

whereas RESULT2 has the Ssn of all employees who directly supervise an 



employee who works in department 5.  

 



The UNION operation produces the tuples that are in either RESULT1 or 

RESULT2 or both, while eliminating any duplicates. 

 

Several set theoretic operations are used to merge the elements of two 



sets in various ways, including UNIONINTERSECTION, and SET 


Download 244.7 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   ...   15




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling