Contents
Index 🔎︎

# 關係

此指令會開啟 [關係設計] 視窗，在此您可以定義各種資料庫表格之間的關係。

在此您可以透過共用資料欄位將目前資料庫的表格連結在一起。按一下 [新增關係] 圖示，或者拖放滑鼠以建立關係。

若要使用此指令...

In a database file window, choose Tools - Relationships.

僅當您使用的是關係資料庫時，此功能才可用。

When you choose Tools - Relationships, a window opens in which all the existing relationships between the tables of the current database are shown. If no relationships have been defined, or if you want to relate other tables of the database to each other, then click on the Add Tables icon. The Add Tables dialog opens in which you can select the tables with which to create a relation.

插入表格...

如果 [關係設計] 視窗開啟，即使在表格設計模式下也無法修改選取的表格。如此可確保建立關係時，表格不會變更。

The selected tables are shown in the top area of the relation design view. You can close a table window through the context menu or with the Delete key.

#### Move table and modify table size

You can resize and arrange the tables according to your preferences. To move tables, drag the upper border to the desired position. Enlarge or reduce the size in which the table is displayed by positioning the mouse cursor on a border or on a corner and dragging the table until it is the desired size.

## Primary key and foreign keys

If you want to define a relation among the various tables, you should enter a primary key that uniquely identifies a data field of an existing table. You can refer to the primary key from other tables to access the data of this table. All data fields referring to this primary key will be identified as a foreign key.

有指定主關鍵字的資料欄位會在表格視窗中，透過一個小鑰匙圖示標示出來。

## 定義關係

All existing relations are shown in the relations windows by a line that connects the primary and foreign key fields. You can add a relation by using drag-and-drop to drop the field of one table onto the field of the other table. A relation is removed again by selecting it and pressing the Delete key.

或者，您也可以按一下關係欄位上方區域中的新增關係圖示，並在[關係]對話方塊中定義兩個表格之間的關係。

新關係...

If you use LibreOffice as the front-end for a relational database, the creation and deletion of relationships is not placed in an intermediate memory by LibreOffice, but is forwarded directly to the database.

按兩下連結線，您可以將某些屬性指定給關係。[關係]對話方塊會開啟。