Beruflich Dokumente
Kultur Dokumente
Chapter 10: Practical Database Design Methodology and Use of UML Diagrams
The same reasoning can be applied to the Homephone and Officephone fields,
breaking them into multiple fields such as AreaCode, PhoneNumber, Extension, etc.
Another possible modification is to increase the size of the Homephone, Officephone,
and SSN fields so that formatting characters can be entered, such as SSN becoming a
VARCHAR(11) to allow for the two dashes in XXX-YY-ZZZZ.
The table design allows for two phone numbers, Homephone and Officephone, either
of which may be NULL. This means that some rows will have empty fields for those
attributes. A solution is then to add a Phone# (SSN, Type, Number) table and remove the
two phone number fields from the Students table. This allows for any student to have
zero or more phone numbers of various types, which we can specify (Home, Office, Cell,
etc.).
Consider not storing the AGE data and instead storing DateOfBirth. Typically only the
year component of Age is stored which is less accurate than if DateOfBirth were stored
and the age computed from it. That is, we can generate Age from DateOfBirth, but we
cannot generate DateOfBirth from Age.
e) A suggested constraint is on the GPA field, to restrict its values from 0.000 to 4.000. This
would, however, prevent the (rarely seen) 10 or 12 point grade scale. Another possible
constraint is to limit Age to be from 0 to 100 (or even a lower maximum value).
10.24 - What naming conventions can you develop to help identify foreign keys more
efficiently?
Answer:
The naming convention can be informally specified as FK followed by the referenced
relationship or relation name, and optionally followed by the primary key of the referenced
table. This foreign key naming convention is frequently used in large databases. Sometimes
this produces very long column names but it pays off by facilitating readability for database
professionals by using more descriptive names.