Efnisyfirlit

# Relations

Allows you to define and edit a relation between two tables.

Til að nálgast þessa skipun...

In a database file window, choose Tools - Relationships.

The update and delete options are only available if they are supported by the database used.

## Tables involved

This is where the two related tables are listed. If you create a new relation, you can select one table from each of the combo boxes in the top part of the dialog.

If you opened the Relations dialog for an existing relation by double-clicking the connection lines in the Relation window, then the tables involved in the relation cannot be modified.

## Key fields

Defines the key fields for the relation.

The names of the tables selected for the link appear here as column names. If you click a field, you can use the arrow buttons to select a field from the table. Each relation is written in a row.

## Update options

Here you can select options that take effect when there are changes to a primary key field.

### No action

Specifies that any change made to a primary key does not affect other external key fields.

### Updating cascade

Updates all the external key fields if the value of the corresponding primary key has been modified (Cascading Update).

### Set null

If the corresponding primary key has been modified, use this option to set the "IS NULL" value to all external key fields. IS NULL means that the field is empty.

### Set default

If the corresponding primary key has been modified, use this option to set a default value to all external key fields. During the creation of the corresponding table, the default value of an external key field will be defined when you assign the field properties.

## Delete options

Here you can select options that take effect when a primary key field is deleted.

### No action

Specifies that the deletion of a primary key will not have any effect on other external key fields.

### Delete cascade

Specifies that all external key fields will be deleted if you delete the corresponding primary key field.

When you delete a primary key field with the Delete cascade option, all records from other tables that have this key as their foreign key are also deleted. Use this option with great care; it is possible that a major portion of the database can be deleted.

### Set null

If you delete the corresponding primary key, the "IS NULL" value will be assigned to all external key fields.

### Set Default

If you delete the corresponding primary key, a set value will be set to all external key fields.