Primary & Foreign Keys
PK & FK 1.Primary key is required 2.The PK must be unique 3.If the primary key from one table is related to a field in another table, the field in the second table is called a foreign key 4.If the PK is AutoNumber and related to a FK, the FK is Number 5.If the PK is any data type except AutoNumber and related to a FK, the FK is the same data type
Constraints
Data Entry Control Standardize data entry – Validation Rules – Default Values – Feeder Tables – Input Masks
Validation Rules Field property Set to limit range of numbers or items Single item – > 1998 Multiple items – “ND”, “SD”
Validation Text Message to let end user know why entry will not work – “Year must be after 1998” – “Please use a two character state abbreviation such as ND”
Default Values Automatically entered Only change data if it is different
Feeder Tables Table with all data options for a field in a different table Appears as list or combo box
Story Time Garbage In Garbage Out – 400,000 vs. 4,000,000
Relationships
Types One-to-One One-to-Many Many-to-Many
One-to-One Least common Used when you have a data dump that is temporary Used when huge number of records but only a few will have this data
One-to-Many Most common – One student many classes – One customer many invoices – One person many DVDs
Many-to-Many Requires a bridge or junction table – Many teachers have many students in many classrooms
Simple to Establish Drag and drop – MemberID to MemberID
Edit Relationships Window Insure you selected the correct fields Enforce Referential Integrity Cascade Update Related Records Cascade Delete Related Records Relationship type
Referential Integrity Prevents orphan records – No records on the many side without a record on the one side – No membership dues paid without a member
Cascade Update Related Fields If primary key is not AutoNumber, please select – If using a social security number and a data entry error was made, when you correct the error, the database automatically goes to related records and corrects them.
Cascade Delete Related Fields When you delete one record, the related records are automatically deleted Watch for – If the related records contain numbers such as dues or donations and you delete them, you will not be able to generate statistical comparison reports.
Relationship Type Type of relationship is displayed If incorrect – Correct fields selected? – Correct data types