Prev | Current Page 392 | Next

Carl Reynolds and Paul Tymann

"Schaum's Outline of Principles of Computer Science"

However, if the minimum cardinality on one side is 0, then make the other relation the
parent. For instance, if there were a 1:1 relationship between ???Room??? and ???Projector???, but not all rooms had
projectors, you would make the Room relation the parent, and put a foreign key column in the Projector
relation. This will be more space-efficient, since you will have a foreign key field only when there is a Projector
tuple to associate with a Room tuple.
For 1:N relationships, the relation on the 1 side will be the ???parent,??? and the relation on the N side will be
the ???child.??? All one must do is add a foreign key column to the child relation so that the ???many??? children can
be related to the ???one??? parent entity. For instance, to implement the advisor/advisee relationship, simply add
a foreign key column to the Student relation, name the foreign key column ???FacultyAdvisor???, and prepare to
populate the column with values of the primary key of the Faculty relation.
Many-to-many relationships are more complex. To implement an N:M relationship, one must create a new
table, a new relation. Such a relation is sometimes called an intersection table or a relationship relation. The
intersection table includes foreign key columns for both entities in the relationship.


Pages:
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404
Potopek uchwyt lcd wyciągarki hotele londyn Wczasy nad morzem