If you ever have trouble with creating relationships

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: because there is already one ­to ­ one correspondence between the field value and the entity. This makes it easier to interact with the database. 1. To set your own primary key, you must determine which field or fields contain information that will uniquely index each record. 2. Open the Student Info table and look at the data. Which field looks like the best choice for the primary key? Yes, that’s right! SSN is a good choice. Each student has a unique SSN or ID number, and most students know it by heart or at least have an ID card with the number on it. a. To set the primary key on the SSN field, you must first switch to the Design View by clicking the Design View button on the Toolbar. b. Select the SSN field by clicking anywhere in the SSN row. 11 Workshop 6: MS Office Access and NeoOffice c. Under Windows: Under OS ­X: Click on PRIMARY KEY in the Design Tab Right click on the gray box to the left of and a key icon will appear in the gray box the field you selected and select Primary next to the field you selected. Key. T o remove a primary key, just click on the field with the unwanted primary key and click on the primary key button in the Design Tab again on Windows and on a Mac you right click deselect Primary Key. 3. Open the Course Offerings table and look at the data. Which field do you think would be the best to set the primary key on? Each class has a unique CRN that has been specifically created to be a primary key. So the CRN would be the best field for the primary key. 4. Set the primary key on the CRN field following the directions in the previous example. 5. Open the Transactions table and set the ID field to be the primary key. This table represents transactions by students and will be used in the examples for queries. 6. Open the Course Sign ­ups table. This table is used to store the SSNs of the students and the CRNs they sign up for. Which field is the best to set the primary key on? Both fields have duplicate entries because each student enrolls in more than one class and each class has more than one student. However, one student cannot sign up for a class more than once so together the two fields are unique. The primary key must be set on both fields. 7. Switch to the design view. 8. To set both fields as the primary key, select both of them by clicking and dragging on the field selectors to the left of the field names on Windows and on a Mac, click on one of the fields, hold down COMMAND on your keyboard and then click on the other field. 9. Click on the primary k...
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