Chapter 3 – ANSWERS (Review Questions)
Q3.1 Which conditions must hold in order for a table to be a relation?
? Each column must have a name. Within one table, each column name must be unique.
? Within one table, each row must be unique.
? Within each row, each value in each column must be single valued. Multiple values of
the content represented by the column are not allowed in any rows of the table.
? All values in each column must be from the same (predefined) domain.
? Order of columns is irrelevant.
? Order of rows is irrelevant.
Q3.2 What is a primary key?
A column (or a set of columns) in a relation whose value is unique for each row; in case there are
multiple candidates, a designer chooses one of the candidates to be the primary key
Q3.3 How is a regular entity with regular attributes mapped into a relation?
Each regular entity becomes a relation, and each regular attribute of a regular entity becomes a
column of the newly created relation. If an entity has a single unique attribute, then that attribute
becomes the primary key in the resulting mapped relation. In case the entity contains multiple
unique attributes a designer chooses one of the candidates to be the primary key
Q3.4 How is a composite attribute mapped into a relation?
Each component of a composite attribute is mapped as a column of a relation, while the
composite attribute itself does not appear in the mapped relation.
Q3.5 How is a unique composite attribute mapped into a relation?
Components of a composite attribute are mapped as columns of a relation that become either a
composite primary key or a composite candidate (but not primary) key.
Q3.6 How is an optional attribute mapped into a relation?
When optional attributes are mapped into relations, the resulting optional columns are marked as
(O).
Q3.7 Give a definition of the entity integrity constraint.
In a relational table, no primary key column can have null (empty) values.
Q3.8 What is a foreign key?
A column in a relation that refers to a primary key column in another (referred) relation.
Q3.9 How is a 1:M relationship between two entities mapped into a relational schema?
The relation mapped from the entity on the M side of the 1:M relationship has a foreign key that
corresponds to the primary key of the relation mapped from the 1 side of the 1:M relationship.
Q3.10 How is an M:N relationship between two entities mapped into a relational schema?
In addition to the two relations representing the two entities involved in the M:N relationship,
another relation is created to represent the M:N relationship itself. This new relation has two
foreign keys, corresponding to the primary keys of the two relations representing the two entities
involved in the M:N relationship. The two foreign keys form the composite primary key of the
new relation.
Q3.11 How is a 1:1 relationship between two entities mapped into a relational schema?
In the same way as 1:M relationships. One of the resulting relations has a foreign key pointing to
the primary key of the other resulting relation. When mapping 1:M relationships, we have to
follow the rule that states that the primary key of the relation mapped from the 1 side becomes a
foreign key of the relation mapped from the M side. In a 1:1 relationship, maximum cardinalities
of both entities are 1. Therefore, we simply choose one of the mapped relations to have a foreign
key referring to the primary key of the other mapped relation.
Q3.12 Give a definition of the referential integrity constraint.
In each row of a relation containing a foreign key, the value of the foreign key EITHER matches
one of the values in the primary key column of the referred relation OR the value of the foreign
key is null (empty).
Q3.13 How are candidate keys mapped into a relation?
Candidate keys that are not chosen as primary keys are marked as unique by showing the letter U
in parentheses next to the names of unique non-primary key columns.
Q3.14 How is a multivalued attribute mapped into a relational schema?
Multivalued attribute are mapped as a separate relation that has a column representing the
multivalued attribute and a foreign key column referring to the primary key of the relation
resulting from the entity itself. Both of these columns form a composite primary key for the
separate relation.
Q3.15 How is a derived attribute mapped into a relational schema?
Derived attributes are not mapped into the relational schema.
Q3.16 How is a 1:M unary relationship mapped into a relational schema?
The relation mapped from an entity involved in a 1:M unary relationship contains a foreign key
that corresponds to its own primary key.
Q3.17 How is an M:N unary relationship mapped into a relational schema?
In addition to the relation representing the entity involved in a unary M:N relationship, another
relation is created to represent the M:N relationship itself. This new relation has two foreign
keys, both of them corresponding to the primary key of the relation representing the entity
involved in the unary M:N relationship. Each of the foreign keys is used as a part of the
composite primary key of the new relation.
Q3.18 How is a 1:1 unary relationship mapped into a relational schema?
The relation mapped from an entity involved in a 1:1 unary relationship contains a foreign key
that corresponds to its own primary key.
Q3.19 How is a weak entity mapped into a relational schema?
The resulting relation has a composite primary key that is composed of the partial identifier and
the foreign key corresponding to the primary key of the owner entity.
Q3.20 How is a ternary relationship mapped into a relational schema?
A new relation is created with foreign keys corresponding to the primary keys of the relations
representing the three entities involved in the ternary relationship.
Reviews
There are no reviews yet.