Database-chap 4 Flashcards
Relational algebra
Relational algebra
Defines the theoretical way of manipulating table contents through a number of relational operators
8 relational operators
SELECT
PROJECT
JOIN
PRODUCT
INTERSECT
UNION
DIFFERENCE
DIVIDE
Unary
One relation
select and project
Binary
Two relations
join(combine two relations in a specified way)
Minimally relational
Used to retrieve information from the basis for data manipulation languages such as SQL
Set theory
Is the theory based on the idea that elements have membership in a set
Select
Can be used to list all of the row values, or it can return only those row values that match a specified criterion
Logical operators
AND, OR, NOT
Project operator
Returns all values for selected attributes, project operator could be used to restrict the columns in each relation over a common attribute
Union set operator(U)
Combines all tuples from two relations, excluding duplicate
Intersect operator(n)
Returns only the tuples that appear in both relations
Difference operator
Returns all tuples in one relation that are not found in the other relation, that is ,it subtracts one relation from another
Equijoin
Links tables on the basis of an equality condition that compares specified columns of each table
The natural join operation
Requires that the 2 operant relations must have at least one common attribute
Key components of the relational model
Is the relation which allows data to be stored within the database in a structured manner
In order to write relational algebraic expressions the following steps should be followed
- List all the attributes we need to give the answer
- Select all the relations which we need, based on the list of attributes
3.Specify the relational operators and the intermediate results that are needed