Database relationships

Database relationships are associations between tables that are created using join statements to retrieve data.

The following table describes the database relationships.

Table 1. Database relationships
Type of relationship Description
One-to-one

Both tables can have only one record on each side of the relationship.

Each primary key value relates to none or only one record in the related table.

Most one-to-one relationships are forced by business rules and do not flow naturally from the data. Without such a rule, you can typically combine both tables without breaking any normalization rules.

One-to-many The primary key table contains only one record that relates to none, one, or many records in the related table.
Many-to-many Each record in both tables can relate to none or any number of records in the other table. These relationships require a third table, called an associate or linking table, because relational systems cannot directly accommodate the relationship.

In the Database Configuration application, you can define Structured Query Language (SQL) statements for joins, and create relationships between parent and child objects. You can use a join to link data from multiple objects. The parent is the existing object and the child is the object that you are create.

Example

Parent = MAXUSER, Child =SITE, and Name = DEFSITE means that maxuser exists and you want to get the site for the default site for the user.

siteid = :defsite

This configuration means site.siteid = maxuser.defsite. When the SQL statement is run, the value of the parent attribute replaces anything preceded by a colon.



Feedback