English 中文(简体)
MS Access - Create Relationships
  • 时间:2024-12-30

MS Access - Create Relationships


Previous Page Next Page  

In this chapter, we will understand the need to create relationships between related tables. One of the goals of good database design is to remove data redundancy.

    To achieve that goal, you spanide your data into many subject-based tables so that each fact is represented only once.

    To do this, all the common fields which are related to each other are placed in one table.

    To do this step correctly, you must first understand the relationship between your tables, and then specify these relationships in your Access database.

Why Create Table Relationships?

MS Access uses table relationships to join tables when you need to use them in a database object. There are several reasons why you should create table relationships before you create other database objects, such as forms, queries, macros, and reports.

    To work with records from more than one table, you often must create a query that joins the tables.

    The query works by matching the values in the primary key field of the first table with a foreign key field in the second table.

    When you design a form or report, MS Access uses the information it gathers from the table relationships you have already defined to present you with informed choices and to prepopulate property settings with appropriate default values.

    When you design a database, you spanide your information into tables, each of which has a primary key and then add foreign keys to related tables that reference those primary keys.

    These foreign key-primary key pairings form the basis for table relationships and multi-table queries.

Let us now add another table into your database and name it tblHRData using Table Design as shown in the following screenshot.

Table Design

Cpck on the Save icon as in the above screenshot.

Save Icon

Enter tblHRData as table name and cpck Ok.

TblHRData

tblHRData is now created with data in it.

Advertisements