Download free books at BookBooN.com
An Introduction to Relational Database Theory
215
Database Design II: Other Issues
For these reasons, perhaps a group-ungroup normal form (GUNF?) could be usefully defined: relvar r is in
GUNF if and only if no attribute of r is relation valued; but as far as the present author is aware no such
definition is to be found in the literature (apart from this book). Codd proposed a normal form that he
called first normal form (1NF), and he included a requirement for 1NF in his definitions for 2NF, 3NF,
and subsequently BCNF. Under 1NF as he defined it, relation-valued attributes were “outlawed”; that is to
say, a relvar having such an attribute was not in 1NF. However, certain examples do exist where to avoid
a relation valued attribute we have to resort to artifice.
Consider, for example, the relvar, in the catalog, to record the keys of all the relvars in the database. The
straightforward definition, shown in Example 8.2, involves a relation-valued attribute.
Example 8.2: Catalog relvar to record keys of relvars, not in GUNF
VAR RELVAR_KEYS BASE RELATION { RelvarName NAME,
Key RELATION { Attr NAME } }
KEY { ALL BUT } ;
We cannot obtain an equivalent design by ungrouping, because a relvar can have several keys. A tuple
appearing in the ungrouping, simply pairing relvar name r with attribute name a tells, us only that a is a
member of some key of r. A truly equivalent design in GUNF is unachievable. The best we can do is
probably as shown in Example 8.3, where we have to introduce an extra attribute. Moreover, this design
does not admit relvars with empty keys (specified by KEY { })those would have to be represented by a
separate relvar in the catalog.
Example 8.3: Catalog relvar to record keys of relvars, in GUNF
VAR RELVAR_KEYS_GUNF BASE RELATION { RelvarName NAME,
KeyNumber INTEGER,
KeyAttr NAME }
KEY { ALL BUT } ;
Having to number the keys of each relvar is artificial and burdensome. Most of the noted disadvantages of
relation-valued attributes are not so relevant here because we expect catalog relvars to be maintained by
the DBMS. The natural, non-GUNF design of Example 8.2 is probably preferable.
Now, Codd’s definition of 1NF attempted similarly to outlaw attributes of certain other types too, because
relation types are not the only types that, if used for attributes of relvars, give rise to the problems
identified with relation types, as we shall now see.
Wrap-unwrap normalization
Instead of defining C_ES with its relation-valued attribute EnrolledStudents, derived from
ENROLMENT using GROUP, we could apply WRAP to derive the relvar C_EST, as shown in Example 8.4.