50 likes | 71 Views
This lab provides hands-on practice with implementing various types of entity relationships such as 1-1 mandatory, 1-M mandatory, 1-M optional, and many-to-many. Learn how to set up primary and foreign keys in Access for each relationship type.
E N D
Implementation ofEntity Relationships • 1-1 Relationship (both mandatory) • 1 table required – attribute of main table • Eg. Doctor has one specialty • 1-1 Relationship (both mandatory) • 2 tables required – foreign key in table • Eg. Doctor has one assigned nurse Implement in Access! Lab 4
Implementation ofEntity Relationships • 1-1 Relationship (one mandatory) • 2 tables required • Primary Key of Mandatory as Foreign Key of Optional • Eg. Nurse / Office (1 nurse in an office) • 1-1 Relationship (both optional) • 2 tables required • Primary Key “Strong” Entity as Foreign Key • FK can be null • Eg. Patient has disease Implement in Access! Lab 4
Implementation ofEntity Relationships • 1-M Relationship (both mandatory) • 2 tables required • Primary Key of 1 as Foreign Key of M • Eg. Doctor / Patient (1 doctor has many patients –no vice/versa) • 1-M Relationship (1 mandatory M optional) • 2 tables required • Primary Key of 1 as Foreign Key of M • Eg. Doctor / Equipment Implement in Access! Lab 4
Implementation ofEntity Relationships • 1-M Relationship (1 optional M mandatory) • 2 tables required • Primary Key of 1 as Foreign Key of M • Eg. Hospital Fire Marshall / Doctors • 1-M Relationship (Both Optional) • 2 tables required • Primary Key of 1 as Foreign Key of M • FK can be null • Eg. Hospitals / Equipment Distributors Implement in Access! Lab 4
Implementation ofEntity Relationships • M-N Relationships • 3 tables required • 2 tables contain primary key and attributes of entities • 1 table contains primary key of 2 entities as foreign keys and other attributes • Eg. Patient / Medication Lab 4