What If There Is No Key

What If There Is No Key

Since keys are optional in ODL, we may face a situation where the attributes available to us cannot serve to represent objects of a class C uniquely.  That situation can be a problem if the class C participates in one or more relationships.

We suggest creating a new attribute or "certificate" that can serve as an identifier for objects of class C in relational designs, much as the hidden object-ID serves to identify those objects in an object-oriented system. The certificate becomes an additional attribute of the relation for the class C, as well as representing objects of class C in each of the relations that come from relationships involving class C. Notice that in practice, many important classes are represented by such certificates: university ID'S for students, driver's-license numbers for drivers, and so on.

Example : Assume we accept that names are not a dependable key for movie stars, and we decide instead to adopt a "certificate number" to be assigned to each star as a way of identifying them uniquely. Then the Stars relation would have schema:

Stars(cert#, name, street, city, birthdate)

If we wish to represent the many-many relationship between movies and their stars by a relation StarsIn, we can use the title and year attributes from Movie and the certificate to represent stars, giving us a relation with schema:

StarsIn(title, year, cert#)