Entity Relationships

Two of the relationships between the entities in the example sales order system are:

The first approximation of the entities is shown in Figure 6. In order to show the relationships between the entities, an entity relationship diagram is used. An entity relationship diagram shows the one-to-many relationships between the entities in a system. The design represents the relationships between the entities in third normal form.

In a sales order system, there are three main entities: CUSTOMER, ORDER and MATERIAL. However, an ORDER entity would not be in third normal form since an order for a single customer can include many materials. An order can therefore be separated into two parts, ORDER HEADER and ORDER LINE. The ORDER HEADER includes the date the order was placed, the customer number and the total value of the order. The ORDER LINE identifies each of the materials ordered. There is a one-to-many relationship between the ORDER HEADER and the ORDER LINE entities.

Once your entities are represented as tables in a DP4 database, the relationships between the tables are known as parent-child relationships. For example, in the diagram shown above, the CUSTOMER table is the parent of the ORDER HEADER table.