Week 4 Flashcards
What is the Relational algebra
A mathematical query language that forms the basis of the SQL query language
What is the Selection operation do?
Selects a subset of rows from relation.
What is the Projection operation do?
Deletes unwanted columns from relation.
What is the Cross-product operation do
Combines two relations.
What is Set-difference operation do?
Tuples in relation 1, but not in relation 2.
What is the Union operation do?
Tuples in relation 1 and relation 2
What will the Schema of the result contain after the projection?
Projection operator eliminate duplicates.
What will the Schema of the result contain after the selection?
The selection operator, selects rows that satisfy selection condition
What will the Schema of result be after the relational algebra operation?
Result relation can be the input for another relational algebra operation
Union Example
Intersection Example
Set difference example
Cross Product example
Both S1 and R1 have a field called sid, Which may cause a conflict when referring to columns
Rename an operator by taking a relation schema and gives a new name to the schema and the columns
What would this Condition join statement equivalent to
What is an Equi-Join
A special case of condition join where the condition c contains only equalities
What would the statement A / B means where A have 2 fields, x and y; B has only the field y.
A/B contains all x values (players) such that for every y value (game) in B, there is an x-y paired value in A
Find names of sailors who’ve reserved boat #103
Find names of sailors who’ve reserved a red boat
What is the 4 conceptual evaluation strategies?
- Comput the cross-product of relation-list.
- Discard resulting tuples if they do not satisfy the conditions.
- Display attributes that are in attribute-list.
- If DISTINCT is specified, eliminate duplicate rows.
Why do we do decomposition?
Are done to remove redundant data that can lead to anomalies
What is the 1st normal form says?
specifies that all tables in a relational database must be structured so that each column contains atomic values. In other words, each column of a table must hold only a single, indivisible value.
What is the 2nd normal form says?
Specifies that a table must be in 1NF and should not have any partial dependencies. In other words, each non-key column in a table should be dependent on the entire primary key, not just part of it.
What is the 3rd normal form says?
Specifies that a table must be in 2NF and no non-prime attribute determines a non-prime attribute (only keys can determine!).