Refining Field Names


Let's do a little work to improve the field names. As in database design, naming conventions are, to some extent, a matter of personal preference. But you should be aware of some useful rules. A field name should appear only once in each database. In databases in which you have much contact information, you could have several tablesCustomers, Suppliers, Shippers, and so onthat have a field named Address. In the Classic TV database, this problem is less pronounced. But in Table 3.26, you still have duplicate fields, such as First Name and Last Name in the Actors and Roles fields.

A good way to resolve this duplication is to prefix each field with the name of the table. Some database designers like to include a table prefix for every field; others use the prefix only where they deem it necessary to avoid confusion with similar fields in other tables.

When field names get too long, a common practice is to abbreviate elements. Thus, a customer address in a Customers table becomes CustAddr, and the address in the Suppliers table is SuppAddr. Other Access experts disagree and prefer to use whole words throughout for completeness and clarity.

Here are a few important rules for naming fields:

  • Identify the field fully and unambiguously.

  • Use a minimal number of words.

  • If you decide to use abbreviations, abbreviate consistently.

    If you abbreviate Address as Addr for one field, try to use Addr for Address throughout the database.

  • Avoid acronyms where you can.

  • Use the singular form (as in CompanyName, not CompanyNames).

    If the plural seems more appropriate, you might have a multivalue field that needs to be resolved.

  • Spell field names without including spaces. If you need to use a separator for clarity, use an underscore instead of leaving a space (as in UNESCO_ID).

In Table 3.29, I've renamed the fields listed in Table 3.26 so that they more closely conform to good naming practice and convention. The names do not represent some state of perfection; other (perhaps better) choices are possible.

Table 3.29. The Fields in Table 3.26 Have Been Renamed to Follow Field-Naming Conventions

Revised Field Names

Programs

Broadcasts

Genres

Networks

Actors

Roles

ProgramID PK

ProgramID CPK/FK

GenreID PK

NetworkID PK

ActorID PK

ProgramID CPK/FK

ProgName

NetworkID CPK/FK

GenreName

Netw OfficialName

ActorFirstName

ActorID CPK/FK

GenreID ]FK

BrdYearStart

GenreDescr

Netw PopularName

Actor LastName

Role* FirstName

ProgLocation

BrdYearEnd

 

NetwFounder

ActorGender

Role LastName

ProgSynopsis

  

NetwNotes

ActorBio

RoleOccup

ProgNotes

    

Role YearStart

     

Role YearEnd

     

RoleNotes

Legend: PK=Primary key; FK=Foreign key; CPK=Composite primary key *Actual field names contain no spaces (Role FirstName is RoleFirstName).





Hands-On Microsoft Access(c) A Practical Guide to Improving Your Access Skills
Hands-On Microsoft Access: A Practical Guide to Improving Your Access Skills
ISBN: 0321245458
EAN: 2147483647
Year: 2005
Pages: 169
Authors: Bob Schneider

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net