Software & Apps MS Office Guide to Database Relationships in Microsoft Access 2013 by Mike Chapple Writer Former Lifewire writer Mike Chapple is an IT professional with more than 10 years' experience cybersecurity and extensive knowledge of SQL and database management. our editorial process Twitter Mike Chapple Updated on March 30, 2019 MS Office Word Excel Powerpoint Outlook Tweet Share Email So you've made the move from a spreadsheet to a database. You've set up your tables and painstakingly transferred all of your precious data. You take a well-deserved break, sit back and look at the tables you've created. Wait a second — they look strangely familiar to the spreadsheets you've just disowned. Did you just reinvent the wheel? What's the difference between a spreadsheet and a database anyway? Database Relationships One of the major advantages of databases such as Microsoft Access is their ability to maintain relationships between different data tables. The power of a database makes it possible to correlate data in many ways and ensure the consistency (or referential integrity) of this data from table to table. In this article, we'll take a look at the process of creating a simple relationship using a Microsoft Access database. Imagine a small database we've created for the Acme Widget Company. We want to track both our employees and our customer orders. We might use a table that contains one table for employees with the following fields: Employee ID (primary key)First NameLast NameExtensionSalaryManager We then might have a second table containing the orders taken by our employees. That orders table might contain the following fields: Order ID (primary key)Customer IDEmployee IDItem IDQuantity Notice that each order is associated with a specific employee. This information overlap presents the perfect situation for the use of a database relationship. Together we'll create a Foreign Key relationship that instructs the database that the EmployeeID column in the Orders table corresponds to the EmployeeID column in the Employees table. Once the relationship is established, we've unleashed a powerful set of features in Microsoft Access. The database will ensure that only values corresponding to a valid employee (as listed in the Employees table) can be inserted in the Orders table. Additionally, we have the option of instructing the database to remove all orders associated with an employee when the employee is deleted from the Employees table. Creating Relationships in Access Here's how we go about creating the relationship in Access 2013: From the Database Tools tab on the Ribbon, click Relationships.Highlight the first table that you want to make part of the relationship (Employees) and click Add.Repeat step 2 for the second table (Orders).Click Close. You should now see the two tables in the Relationships window.Click Edit Relationships in the ribbon.Click Create New.In the Create New window, choose Employees as the Left Table Name and Orders as the Right Table Name.Choose EmployeeID as both the Left Column Name and Right Column Name.Click OK to close the Create New window.Use the checkbox in the Edit Relationships window to choose whether to enforce Referential Integrity. In most circumstances, you will want to select this option. This is the real power of a relationship — it ensures that new records in the Orders table only contain the IDs of valid employees from the Employees table.You'll also notice two other options here. The Cascade Update Related Fields option ensures that if an EmployeeID change in the Employees table that change is propagated to all related records in the Orders table. Similarly, the Cascade Delete Related Records option removes all related Orders records when an Employee record is removed. The use of these options will depend upon the particular requirements of your database. In this example, we'll won't utilize either one.Click Join Type to see the three options available to you. If you're familiar with SQL, you might notice that the first option corresponds to an inner join, the second to a left outer join and the final to a right outer join. We'll use an inner join for our example.Only include rows where the joined fields from both tables are equal.Include ALL records from 'Employees' and only those records from 'Orders' where the joined fields are equal.Include ALL records from 'Orders' and only those records from 'Employees' where the joined fields are equal.Click OK to close the Join Properties window.Click Create to close the Edit Relationships window.You should now see a diagram showing the relationship between the two tables.