Relational Algebra Flashcards
What is relational algebra
It defines the theoretical ways of manipulating table contents using relational operators.
what are the relational operatros
- Union / Intersect
- Difference / Product
- Select / Project / Join / Divide
Unary operator
work on one table at a time.
Select
yields values for all rows in a table satisfying a certain condition.
project
yields values for selected attributes. (cols).
Union
combines rows from two tables excluding duplicates.
what is union-compatible
the two tables must have the same attribute characteristics.
Intersect
yields the rows that appear in both tables.
must be union- compatible.
Difference
Yield all rows that are in the first table that are not found in the second table.
product
AKA catersian product
- yields all possible pairs of rows from two tables.
What is a join
A join allows information to be intelligently combined from two or more tables.
Natural join or Inner join
Returns the matched records from the tables being joined.
Naturally by:
-product
-select
-project
Outer join
The matched pairs would be retained, and any unmatched values in the
other table would be left null.
Left Outer join
All the matched rows as well as the unmatched rows of the left table. RIght will be null.
Right outer join
All matched rows plus the unmatched rows of the right table. left will be null.