Workshop_6

Workshop_6

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: exist, you may need to select more than one field or have Access create one for you using the AutoNumber feature. AutoNumber is great when the key field is only used internally in the database, or when it is not necessary to access the record for a particular entity on demand. Typically, the entities whose records have to be accessed on demand are people, as when you order by phone, check books out from the library, make a credit card payment, or go to the ARC. You may have noticed that in all of those instances the burden of finding your record is placed on you; and you have to produce a card or number that allows the operator to find your record. For example: The UC Davis RSVP system is a large database that keeps track of every student. An excellent choice for a primary key would be the student’s Social Security Number (SSN), because each SSN is unique, and pretty much everyone has learned that number and remembers it. A name would not be a good choice because many students have the same name. However, because of identity security issues, the SSN should no longer be used as an ID. UC Davis has phased out SSN and creates a unique student ID for each student. Have you ever noticed how the cashier at the grocery store enters “codes” for all produce that is not packaged and has no bar codes? You guessed it! They had to learn the values of the primary key for each item. I am sure that you have noticed that the link between the physical item on the scale and what you get charged is completely dependent on the code entered by the cashier. That is a weak link in the system, because the computer has no way of knowing if the fruit on the scale (bananas) actually costs what the key code entered by the cashier indicates (star fruit @ $12.99 per lb). The MyPeople table that you created did not have a good field to be a primary key. This is because you could have more than one friend with the same first and last names. This is unlikely, but very possible. Database design requires that it be impossible for two entities to end up with the same value in the key field. So we had to let Access create one for us, the ID field with AutoNumber values. Each time you add a new record, Access automatically adds a unique number in the ID field. The key field is identified in design view by a KEY icon in the corresponding field selector Setting Your Own Primary Key In some instances, there are fields that are natural candidates for primary keys. When those fields are part of the database, it makes sense to use them instead of AutoNumber,...
View Full Document

This note was uploaded on 06/03/2012 for the course PLS 21 taught by Professor Lieth during the Summer '08 term at UC Davis.

Ask a homework question - tutors are online