How to Create a Microsoft Access Relationship Design (Step-by-Step)

Articles Index

Course Listing

Free Catalog

Request Information

What's New

Page 1 | Page 2 | Page 3 | Page 4

About

Modifying the Join Properties

One final topic: join properties. Once again, let us modify our business rules a bit. We want a join of employees and labor to default to an outer join. That way we will see all employees even if they have not recorded time during the period of our analysis.

To do this we will modify the join properties of the relationship between employees and the labor table.

Right click on the relationship line between employees and labor.

Employees to labor relationship

You can also select the relationships line and then go to the ribbon.

Edit Relationships command 

In either case click edit relationships to bring up the edit relationship dialogue.

Edit Relationships 

Click on join type. This will bring up the join properties dialogue box.

Join Properties 

The three choices above represent three join types.

Join Types

  1. Inner Join - This means that the primary key (PK) in the employee records is matched against the foreign key (FK) in the labor table. If they match that record is retrieved. If they don't match it is not. In other words an employee with no labor tickets will not show in the result yet. This is the default join type and is usually what you want. But there are many cases in which it is not. See below

  2. Left Outer Join - This is the one we want for this example. It is an outer join. In particular a left outer join. The "left" table is the one with the PK. In this case it means that all employee records will be retrieved whether or not they have a matching labor ticket. If there is no match, the missing fields in the result will be filled with nulls. This join type is very common for reporting. As an example: "let me see a list of all my employees over the report period and the hours they worked. If they did not work than show a blank; don't drop them from the report."

  3. Right outer join - Similar to the above but adds all unmatched records from the right table instead of the left table. In this it would be all labor tickets with no corresponding employee. There would not be any of these if you are enforcing referential integrity as we are.

Relationship Window

Click OK  and you will see the relationship design window below. Note the little arrow at the many end of the relationship line between employees and labor. This denotes an outer join. It point to the table that will have added phantom records in the result set. In this case when employees and labor are joined the employees with no matching labor records will still show in the result set but the labor fields will be set to nulls.

Final Design

As a reminder, I would NOT normally set up the relationship design this way. This is just for illustration. You would probably want to undo the outer join and set the relationship between labor and work orders to enforce referential integrity. But you know how to do that now.

Hopefully, you have found this article useful. Many of our classes start off with this little database and we like to have the students walk through the relationship design.

Dan D'Urso
Laguna Niguel, CA 92677
August 2012
articles at dhdurso dot org

HTML Comment Box is loading comments...


Submit the form below to be notified of new articles or other Microsoft Access resources made available...

Receive course announcements and news. Sign Up Today!





Email Marketing by VerticalResponse

Inquire about classes or tutoring...

View MS Access course catalog.


Please send comments and suggestions to WebMaster at dhdurso.org

Copyright 2017 D.H.D'Urso & Associates, Laguna Niguel, Orange County, California 92677

 Articles Index | Close Window | Next| Top