Quan hệ

Lệnh này mở cửa sổ Thiết kế Quan hệ mà cho phép bạn xác định quan hệ giữa các bảng cơ sở dữ liệu khác nhau.

Ở đây thì bạn có thể liên kết với nhau các bảng từ cơ sở dữ liệu hiện thời thông qua các trường dữ liệu chung với nhau. Nhấn vào biểu tượng Quan hệ mới để tạo quan hệ, hoặc kéo và thả bằng con chuột.

Để truy cập lệnh này...

In a database file window, choose Tools - Relationships.


Biểu tượng Ghi chú

Hàm này chỉ sẵn sàng khi bạn thao tác cơ sở dữ liệu quan hệ.


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.

Add Table Icon

Chèn bảng

Biểu tượng Ghi chú

Cửa sổ Thiết kế Quan hệ còn mở thì không thể sửa đổi bảng đã chọn, ngay cả ở chế độ Thiết kế Bảng. Do đó đảm bảo rằng bảng không bị thay đổi trong khi tạo quan hệ.


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.

Dời bảng và sửa đổi kích cỡ bảng

Bạn có khả năng thay đổi kích cỡ của các bảng, và sắp đặt các bảng, tùy theo ý kiến của mình. Để di chuyển bảng, kéo đường viền bên trên sang vị trí đã muốn. Tăng hay giảm kích cỡ của bảng bằng cách kéo một đường viền hay góc của bảng đến khi tạo kích cỡ đã muốn.

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.

Tất cả các trường dữ liệu mà tham chiếu đến một khoá chính sẽ được ngụ ý trong cửa sổ bảng bằng một ký hiệu khoá nhỏ.

Xác định quan hệ

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.

Thay vì vậy, bạn cũng có thể nhấn vào biểu tượng Quan hệ mới trong vùng trên của trường quan hệ, và xác định quan hệ giữa hai bảng trong hộp thoại Quan hệ.

New Relation Icon

Quan hệ mới

Biểu tượng Cảnh báo

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.


Bằng cách nhấn đôi vào một đường kết nối, bạn có thể gán một số thuộc tính nào đó cho quan hệ đó. Hộp thoại Quan hệ sẽ mở.

Please support us!