Relationships in Microsoft Access The Access Workbench: Section Five DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 3 rd Edition
KROENKE and AUER - DATABASE CONCEPTS (3 rd Edition) © 2008 Pearson Prentice Hall AW-5-2 Section Objectives Understand 1:1 relationships in Access Understand N:M relationships in Access
KROENKE and AUER - DATABASE CONCEPTS (3 rd Edition) © 2008 Pearson Prentice Hall AW-5-3 Relationships in Access All the tables we’ve used so far in Access have had 1:N relationships How are 1:1 and N:M relationships managed in Access?
KROENKE and AUER - DATABASE CONCEPTS (3 rd Edition) © 2008 Pearson Prentice Hall AW-5-4 N:M Relationships in Access Pure N:M relationships occur in data modeling When a data model is transformed into a database design, an N:M relationship is broken down into two 1:N relationships Each 1:N relationship is between a table resulting from one of the original entities in the N:M relationship and a new intersection table. Since databases are built in Access from the database design, Access only deals with the resulting 1:N relationships—as far as Access is concerned there are no N:M relationships!
KROENKE and AUER - DATABASE CONCEPTS (3 rd Edition) © 2008 Pearson Prentice Hall AW-5-5 1:1 Relationships in Access: The 1:1 Relationship Between SALESPERSON and VEHICLE
KROENKE and AUER - DATABASE CONCEPTS (3 rd Edition) © 2008 Pearson Prentice Hall AW-5-6 Database Column Characteristics: The VEHICLE Table Column NameTypeKeyRequiredRemarks InventoryIDAutoNumberPrimary KeyYesSurrogate Key ModelText (25)NoYes VINText (35)NoYes VEHICLE
KROENKE and AUER - DATABASE CONCEPTS (3 rd Edition) © 2008 Pearson Prentice Hall AW-5-7 VEHICLE Data InventoryIDModelVIN [AutoNumber]HiStandardG06HS [AutoNumber]HiStandardG06HS [AutoNumber]HiStandardG06HS [AutoNumber]HiLuxuryG06HL [AutoNumber]HiLuxuryG06HL [AutoNumber]HiLuxuryG06HL [AutoNumber]SUHiG06HU [AutoNumber]SUHiG06HU [AutoNumber]SUHiG06HU [AutoNumber]HiElectraG06HE
KROENKE and AUER - DATABASE CONCEPTS (3 rd Edition) © 2008 Pearson Prentice Hall AW-5-8 SALESPERSON.InventoryID Column Characteristics Column NameTypeKeyRequiredRemarks InventoryIDIntForeign KeyNo SALESPERSON
KROENKE and AUER - DATABASE CONCEPTS (3 rd Edition) © 2008 Pearson Prentice Hall AW-5-9 SALESPERSON.InventoryID Data NickNameLastNameFirstName...InventoryID TinaSmithTIna...4 Big BillJonesWilliam...5 BillyJonesBill...7
KROENKE and AUER - DATABASE CONCEPTS (3 rd Edition) © 2008 Pearson Prentice Hall AW :1 Relationships in Access: A 1:N Relationship is Created by Default The VEHICLE to SALEPERSON relationship The relationship is 1:N—this is not the 1:1 relationship we wanted!
KROENKE and AUER - DATABASE CONCEPTS (3 rd Edition) © 2008 Pearson Prentice Hall AW :1 Relationships in Access: Setting the Indexed Property Value in the SALESPERSON Table Select the InventoryID field Set the Indexed property to Yes (No Duplicates)
KROENKE and AUER - DATABASE CONCEPTS (3 rd Edition) © 2008 Pearson Prentice Hall AW :1 Relationships in Access: The Correct 1:1 VEHICLE to SALESPERSON Relationship The VEHICLE to SALEPERSON relationship The relationship is now the correct 1:1 relationship we wanted!
Relationships in Microsoft Access End of Presentation on The Access Workbench: Section Five DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 3 rd Edition