Lecture 2 Flashcards
What is πA1, A2, …, An(R)?
This is the projection, that denotes a relation based on R, that only comprimises only attributes A1, A2, A3, …, An from R
E.g. πtitle(Movies) would only return a tuple of movie titles
What is σC(R)?
Returns a new relation on R which comprises only tuples from R that meet condition C
What is a Cartesian product?
A x B = {(a, b) | a in A and b in B}
What is the Natural Join?
You naturally combine the tuples that match along the attributes that are both in the schema of R and S
What is a Theta-Join?
Join if a certain condition is equal
What is the notation to rename?
ρS(B1, B2, …, Bn) (R), this renames R to B
What is a superkey?
Any set of values that is able to uniquely identify a row in a table.
What is functional dependency?
If for any two tuples that agree on their components for {A1, …, An} they must also agreen in {B1, … Bn}
How can A1 … An –> B1 … Bm be rewritten?
A1 … An –> Bi for i = 1, …, m
What is a closure of a set?
It returns what is functionality determined determined by A under S?
What is the algorithm of a closure?
- If necessary split the FD’s of S, so each FD in S has a single attribute on the right
- Let X be a set of attributes that eventually will become the closure. Initialize X to be {A1, A2, …, An}
- Repeatedly search for some FD B1B2…Bm –> C
st. all of B1, B2, …, Bm are in the set of attributes X but C is not. Add C to the set X and repeat the search. Since X can only grow, and the number of attributes of any relation schema must be finite, eventually nothing more can be added to X, and this step ends. - The set X, after no more attirbutes can be added to it, is the correct value of {A1, A2, …, An }+
What are the requirements of the minimal basis?
A minimal basis B for S satisfies three conditions:
- All FDs in B have sinngleton right hand sides
- If any FD is removed from B, it is no longer a basis for S
- if for any FD we remove one or more attributes from the left hand side it is no longer a basis for S
What is the relation schema of a relation?
It denotes the name of the table and what is in it. E.g. Movie(name, length, studio, year)
How to find a minimal basis?
- Make sure every relation has just one element at the RHS
- Ignore one FD, check if the closure of the LHS is still the same as before, if so, then it can be dropped.