Relational algebra, Union Operations, Binary Operations, Difference, Cartesian product 

By: Prof. Dr. Fazal Rehman | Last updated: March 3, 2022

Relational algebra, Union Operations, Binary Operations, Difference, Cartesian product 

Relational algebra is a query language that processes one or more relations to define another relation. The basic operation of relational algebra are as follows; 1.Unary operations Selection, Projection Operations which involve only one relation are called unary operations. 2.Binary operations: Operations which involve pairs of relations are called binary operations. Examples: Union, Difference, Cartesian product Selection operation: Selection operator is Sigma∑ It acts like a filter operation on relations. ∑ c (R) Returns only those tuples in R that satisfy condition C Conditions: Comparison operators = < > = Logical operators Name Office Dept Rank Saleem 400 Cs Assistant Junaid 220 Econ Lecturer Ghafoor 160 Econ Assistant Babar 420 Cs Assistant Saleem 500 Fin associate Table: EMP Example Select only those employees who are in cs department BUT NOT lecturer AND NAME IS NOT SALEEM Solution: ∑ Dept = ‘cs’ AND-SYMBOL ¬(Rank=’lecturer’ AND-SYMBOL Name=’Saleem’)(Emp) Example Select only those employees who are not in the cs department or lecturer. ∑ ¬(Rank=’lecturer’ OR-SYMBOL Dept = ‘cs’)(EMP) Example: Select only those employers who are assistant or in the economics department ∑ rank=’assitant’ OR-SYMBOL Dept = ‘Economics’(EMP) Example: Select only those employees with the last name Saleem who are assistant. ∑ Name=’Saleem’ AND SYMBOL Rank = ‘assistant’ (EMP) Example: select only those employees who are in the CS department ∑ Dept = ‘Cs’ (EMP) “>

Leave a Comment

All Copyrights Reserved 2025 Reserved by T4Tutorials