Relational Algebra Flashcards
Filters the tuples of a resulting relation R based on the condition provided.
Select Operation
Operation that uses the where clause.
Select Operation
Operation where the number of attributes from the original relation is the same with the resulting relation but with more or less tuples.
Select Operation
Filters the attributes/columns of a resulting relation R based on the attributes listed.
Project Operation
Renames the attributes, the relation or both.
Rename Operation
Operation that uses the select clause.
Project Operation
Operation that uses the “as” clause or alias.
Rename Operation
Show all employees whose monthly salary is above PhP30,000 and belongs to department 3, 4, and 5.
O salary > 3000 and department >= 3 and department <= 5 (employee)
Show all last names, department numbers, monthly salaries of employees.
Pi lastname, department, salary (employee)
Show the last names and department numbers of employees whose monthly salary is greater than Php 30,000
Pi lastname, department (O salary > 30000 (employee))
Given a relation dept with attributes (deptno, dname, loc), rename the attributes deptno to deptnumber and loc to location.
P dept(deptnumber,dname,location) (dept)
Assumes type compatibility and the resulting column header, if valid operation, comes from the first relation.
Set Operation
Allows us to create a relation between two or more relations.
Set Operations/Join and Join-like operations
Given two relations S and T, they are said to be type compatible iff: (2 reasons)
- They have the same number of attributes
- Type(as1 = at1_, type(as2 = at2), …, type(asn =atn)
What are the three different set operations you can perform on relational algebra?
Set difference (-), union (U), and intersection (inverted U)
In this operation, if attributes have the same name, the columns are preserved.
Join and join-like operations.
Given relation S and T, this matches all tuples from S and T if the values from the attributes common to S and T are the same.
Natural Join (*)
Given relations S and T, equi-join matches all tuples from S and T if the values from the attributes define to match from S and T.
Equi-Join (ribbon symbol)
Given relations S and T, semi-join behaves like a natural join except that it does not include the columns in S or T
Semi-join (partial ribbon)
Given relations S and T, anti-join behaves like a semi-join but shows only tuples in S not present in T.
Anit-join (triangle >)
Given relations S and T, the result of division is the set of columns as’ (from S) where the values from column(s) at’ are present.
Division
In this operation, if attributes have the same name, the columns are preserved but includes non-matching tuples.
Outer join operations
Allows us to join relations S and T allowing S tuples to appear without matching tuples from T.
Left Outer Join ( ]ribbon )
Allows us to join relations S and T allowing T tuples to appear without matching tuples from T.
Right outer join ( ribbon[ )