Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 Primary & Foreign Keys

2 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

3 Constraints

4 Data Entry Control Standardize data entry – Validation Rules – Default Values – Feeder Tables – Input Masks

5 Validation Rules Field property Set to limit range of numbers or items Single item – > 1998 Multiple items – “ND”, “SD”

6 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”

7 Default Values Automatically entered Only change data if it is different

8 Feeder Tables Table with all data options for a field in a different table Appears as list or combo box

9 Story Time Garbage In Garbage Out – 400,000 vs. 4,000,000

10 Relationships

11 Types One-to-One One-to-Many Many-to-Many

12 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

13 One-to-Many Most common – One student many classes – One customer many invoices – One person many DVDs

14 Many-to-Many Requires a bridge or junction table – Many teachers have many students in many classrooms

15 Simple to Establish Drag and drop – MemberID to MemberID

16 Edit Relationships Window Insure you selected the correct fields Enforce Referential Integrity Cascade Update Related Records Cascade Delete Related Records Relationship type

17 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

18 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.

19 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.

20 Relationship Type Type of relationship is displayed If incorrect – Correct fields selected? – Correct data types


Download ppt "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."

Similar presentations


Ads by Google