Chapter 3 Building Physical Diagrams


Defining references in a physical diagram

A reference is a link between a parent table and a child table. It defines a referential integrity constraint between column pairs for a primary key, or alternate key, and a foreign key, or between user specified columns in both tables.

When column pairs are linked by a reference, each value in the child table column refers to an equivalent value in the parent table column.

Within a reference, each column pair is linked by a join. Depending on the number of columns in the primary key, or alternate key, or the number of specified columns, a reference can contain one or more joins.

A reference normally links primary key, or alternate key, columns to foreign key columns.

Example

The two tables SALE and STORE are linked by a reference. STORE is the parent table and SALE is the child table. The reference contains a join which links the primary key column STORE ID (the referenced column) to the foreign key column STORE ID (the referencing column).


Linking keys and user-specified columns

Depending on its properties, a reference can link a parent table and a child table in two ways:

Reference links Description
Primary key, alternate key and foreign keys Primary or alternate key in the parent table is linked to a foreign key in the child table
User specified columns One or more columns in the parent table are linked to corresponding columns in the child table. The linked columns in both tables are specified by the user, and are linked independently of primary key, alternate key, and foreign key columns

 


Copyright (C) 2005. Sybase Inc. All rights reserved.