Chinese Access2000 Express Tutorial--1.8 Define the relationship between tables

Source: Internet
Author: User
Tags define
access| Tutorials | crash | chinese

Eighth. Define the relationship between tables

Once you have defined the primary key and the corresponding table, you can set up a relational database by developing a relationship between the various tables. Database of application and management relationships, Chinese Access 2000 is very powerful, which is not what Chinese visual FoxPro 6 does with Chinese Excel 2000. In order to establish a relational database, you first have to set up the related tables, and then close them all, you can follow these steps.

Note: Chinese Access 2000 cannot create or modify relationships between open tables, so closing all open tables is somewhat different from the Chinese visual FoxPro 6.

Step one, press the F11 function key on the keyboard to switch the current operation window to the Database window.

Step Two, click the Relationships button on the Database toolbar, see Figure 39.

Thereafter, if a relational table already exists in the current database, the Relationship dialog box, shown in Figure 40, is displayed on the screen. If the current database does not have any relationships defined, Chinese Access 2000 automatically displays the Show Table dialog box, allowing you to select the table from which you want to create a relationship, as shown in Figure 41.

Figure 39 Click this button

Figure 40 Select this command from this shortcut menu

If you need to add a relational table that is not listed in the Relationships dialog box, you need to go to the Show Table dialog box so you can right-click anywhere in the Relationships dialog box and choose Show Table from one of the shortcut menus, Figure 41. Next you can select the table you want to join in the Table tab of the dialog box, and then click the Add button. The following actions will use the three data tables, "Employees and Tasks", "Customers and Sales", "Customer and contract amounts", all of which were established prior to this, and the data records entered are simple, as shown in Figure 42, which you can build yourself.

Figure 41 Entering the Show Table dialog box

Figure 42 establishes relationships for these three tables

Note: The purpose of establishing relationships for several tables is to make them form relational databases, which is to become "related tables."

In step three, drag the related field from a table to the related field in the other table.

To drag multiple fields, you can select them by pressing the CTRL key on your keyboard before dragging and clicking each field you want to drag. In most cases, Chinese Access 2000 requires that the primary key field in the table (shown in bold text) be dragged to a similar field (often with the same name) that is named the foreign key in the other table, as shown in Figure 42, which has the ID field in each table. Related fields do not need to have the same name, but they must have the same data type (with only two exceptions) and contain the same kind of content. In addition, when the matching fields are number fields, they must have the same field Size property setting. Two exceptions to the matching data type are:

Figure 43 Entering the Edit Relationship dialog box

1. The number field of the AutoNumber field and the field Size property is set to the long integer data type to match.

2. The number field of the AutoNumber field and the field Size property set to the replication ID data type can match.

Step four, in the Edit Relationships dialog box shown in Figure 43, check that the field names displayed in two columns are the same. To ensure correctness. This can be changed if necessary. If you want, you can also set the relationship options. Finally, click the Create button.

Figure 44 The results of the above operations

Next, you can follow these steps to manipulate each table you want to create an association with. The primary key used by this chapter is the ID field, so the result of the operation is shown in Figure 44. In the illustration, the ID field in each table uses a polyline to connect to the same field in the other, which is the method of an Access 2000 association relationship. After that, when you close the Relationships window, you will also be prompted to ask if you want to save this layout configuration. The relationships you create are saved in the current database, regardless of whether you save this configuration.

Note: If you want to see all the relationships defined in the database, click the Show All Relationships button on the Database toolbar. If you want to view the relationships defined in a table, click the table, and then click the Show Direct Relationships button on the Database toolbar. To change the design of a table, you can right-click it and then use the table Design command on the shortcut menu to manipulate it.

Summarize:

This section describes the Chinese Access 2000, the software is very powerful in data processing, highlighting the features of its visual mode of operation. If you have a clear understanding of database and table building and application methods, and related concepts, then learning here is not a struggle, the examples provided in this tutorial do not use more fields, data records are only a few lines, you can easily build them. Next, the tutorial will apply Chinese Access 2000 with the established indexes and relationships, and you will see different ways of doing things with the Chinese visual FoxPro 6, and they all have the same functionality.

Study Questions

1. In Chinese Access 2000 can establish database and table operation method is what?

2. What are the "forms", "Windows", "dialog boxes" used in this chapter? What are the characteristics of each?

3. What is a "primary key"? Why do you use it?

4. What is the relationship between creating an index and defining a table?



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.