50 likes | 65 Views
Implementation of Entity 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!.
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