How To Link Two Tables

Table of contents:

How To Link Two Tables
How To Link Two Tables

Video: How To Link Two Tables

Video: How To Link Two Tables
Video: How to Connect Tables in Excel 2024, May
Anonim

In relational database management systems, all stored information is presented in different tables. This ensures that data redundancy is eliminated. The selection and work with the necessary information in such a database is realized, among other things, using the mechanism of linking tables. The link between two tables is carried out by a common field in both of them and is specified in the data schema of the current database. Moreover, it is necessary to set a certain data type for the fields of the linked tables. Otherwise, the creation of a link between the tables will be of the wrong type or will not happen.

How to link two tables
How to link two tables

Necessary

Microsoft Access DBMS

Instructions

Step 1

Open your database in Microsoft Access DBMS. In order to establish a tabular link, it is necessary to have at least two tables in the database.

Step 2

Fill in the fields of the tables with data. However, keep in mind that to link these table fields, they must have a similar data type. When creating a one-to-many relationship, the field in the first table can be of the Counter type. In this case, the corresponding field of the second table must be of a numerical form. Set the field with the counter type as the key.

Step 3

Open the data schema of the current database. To do this, select the "Tools" - "Data Schema …" items in the Access DBMS menu. An area will appear on the screen, which contains all the related elements of the base. If the area is empty, the Add Tables window will automatically open. Otherwise, it is called from the context menu of this area.

Step 4

Include the linked tables in the open data schema. To do this, select the name of the required table in the list and click the "Add" button. In this case, images of tables with fields will appear in the diagram area.

Step 5

Build a relationship between tables. To do this, use the mouse to grab the link field in one of the tables, drag and drop it over the same field in the other table. Then the application will display the connection establishment window.

Step 6

In this window, in the drop-down lists, specify the required names of the fields, if you could not set them exactly by moving the mouse. Select all item check boxes to ensure data integrity and cascading data changes in related tables.

Step 7

The set type of relationship will be displayed at the bottom of the window. There are three types of relationship in total: one-to-one, one-to-many, and many-to-many. If you needed a relationship of a different kind for the linked tables than is reflected in the window, then you have incorrectly set the data types of the fields of your tables.

Step 8

To establish a connection, click the "Create" button in the window. In the data schema area, a link appears between the two tables from one field to the next. The link type will be schematically displayed in the window on the line with the number 1 and an infinity sign, denoting a "to many" relationship. Save the database. The two database tables are now linked in the indicated relationship.

Recommended: