Chapter 5 Review Questions
Define foreign key. What is this concept used for?
A foreign key is a key that references the primary key of another tuple. It is used to maintain referential integrity and to show relationships from one tuple or attribute to another attribute or tuple.
Domain
A set of atomic values; atomic meaning it is indivisible as far as the formal relational model is concerned. (e.g. Ssn: 9-digit social security number)
What is the difference between a key and a superkey?
A superkey specifies a uniqueness constraint, meaning no two tuples in the relation can have the same value for the SK. A key is a minimal superkey, meaning that we cannot remove any attributes and still have the uniqueness property hold. (Superkeys do not have the minimality property. (the {Ssn} attribute set is a key, but the {Ssn, Name, Age} set is just a superkey.
What is a transaction? How does it differ from an Update operation?
A transaction is an executing program that includes some database operations, that must leave the database in a valid state.
Why are tuples in a relation not ordered?
Elements in a set do not have a particular or in Mathematics; a relation is not sensitive to the order of the tuples.
Discuss the entity integrity and referential integrity constraints. Why is each considered important?
Entity integrity states that no primary key can have a NULL value. This is because the primary key is used to identify a tuple, and if two tuples have NULL for their primary keys, they will be indistinguishable and unidentifiable. Referential integrity constraint states that a tuple in one relation that refers to another relation must refer to a tuple that exists in that relation.
Why are duplicate tuples not allowed in a relation?
It is an inherit constraint, meaning the database would inherently not be able to function if this constraint was violated. By definition, all elements in a set are unique, so all tuples in a relation must be.
Attribute
Name of the role played by some domain in the relation schema
degree of a relation
Number of attributes in a relation schema. A student attribute of degree seven would contain seven attributes (name, ssn, major, gpa, etc.)
N-tuple
Ordered list of n values, where each value is a values in the domain or a NULL value.
Why do we designate one of the candidate keys of a relation to be the primary key?
The primary key is used to identify the tuple. The primary key can be chosen arbitrarily from the candidate keys since candidate keys will all be unique, however it is better to use a key with one value or a small value set.
Relation schema
Used to describe a relation state
Relational database state
the valid tuples that represent a particular state of the real world