Chapter 2: Relational Model Flashcards
What is the language of the Relational Model?
Relational Algebra
Why is it simple to access information within a relational model?
It is easy to access information because the Relational Model is built as a grid (table)
How do the operators act in Relational Algebra?
They act horizontally and vertically.
Should all attributes in a relation be atomic or composite and why?
Atomic so everything will be in first normal form. Having attributes being composite leads to issues later down the line.
What is null?
A special value that is an unknown value.
What is a relation (mathematical definition)?
A subset of the complete cartesian product of a set of n-tuples.
What is the domain of the attribute?
a set of allowed values for each attribute
What are attribute values (normally) required to be?
atomic
When is a domain atomic?
When all of its members are atomic
What value is a member of every domain?
null
What is a database (in context of relational models)?
It is a set of tables and relations between tables.
What is the purpose of foreign keys?
They serve as identifiers to the parent.
What must children do in relations and RDB?
The child must know who the parent is in RDB.
What is a foreign key?
The parent’s primary key that the child is holding.
What does the relational algebra select operator do?
It chooses rows/tuples
- operates horizontally
- SQL equivalent: WHERE
What does the relational algebra project operator do?
Displays the contents of a column
- operates vertically
- SQL equivalent: SELECT
What does the relational algebra union operator do?
brings tables together
- operates horizontally
- SQL equivalent: UNION
- UNION ALL gives you a multi-set output
What does the relational algebra set difference operator do?
Removes the items that relation 1 has in common with relation 2 and displays relation 1 after this
- operates horizontally
- relations must be compatible
- SQL equivalent: EXCEPT, MINUS
What does the relational algebra cartesian product operator do?
Joins two tables together
- operates horizontally and vertically
- SQL equivalent: , (a comma)