Relational Algebra Final PPT 08-06-2023
Relational Algebra Final PPT 08-06-2023
Puttaswamy B S
Assistant Professor
Learning Outcomes
• σ<Selection condition>(R)
• σ - represent the SELECT command
• <selection condition> - represent the condition for selection.
• (R) - represent the Relation or table from which we are making a
selection of the tuples.
σ Name and Age>21 (Student_Details)
• σname = “Nicholas_sparks”(Novels)
• σ<cond1>(σ<cond2>(R)) = σ<cond2>(σ<cond1>(R))
operation.
• R ⟗ <join condition> S
Inner Join
• Return all the tuples that have matching values in both the
tables.
• All those tuples which do not satisfy the required conditions are
excluded.
Natural Join
• Returns all the tuples of the left relation and the tuples of the
right relation that has matching values in the left relation.
• If there is no matching result in the right table, it will return
NULL values in that field.
• SELECT * FROM TableA
• LEFT OUTER JOIN TableB
• ON tableA.name = tableB.name;
Right Outer Join
• Combines all the tuples from the left relation and right relation
which are having the same value on the common attribute (it's a
union of both).
• Also, they will have all the remaining tuples which are not common
on in both the relations.
• SELECT * FROM TableA
• FULL OUTER JOIN TableB
• ON TableA.name = TableB.name;
DIVISION OPERATION
Introduction
• Dividing one number by another number.
• Division operation is a binary relational operation that returns
selected attributes in first relation, matching with every tuple in
second relation.
• Syntax: X÷Y can apply if and only if:
• Attributes of Y is proper subset of Attributes of X
• Proper Subset:
• A= {1,2,3} is a proper subset of B = {1,2,3,4} because the element 4
is not in the first set A.}
• After division operation, remaining attributes in table will be = (All
attributes of X – All Attributes of Y).
• After division operation, Relation will return those tuples from
relation X which are associated to every tuple of Y.
Why Division?