Detailed
Design Document Department of Computer
Science Page maintainer: Terrence
Asgar-Deen |
The Entity Relationship Diagram (ERD) for the Sales Routing System is presented above. The purpose of the ERD is to illustrate the basic data abstraction of the system. For the Sales Routing System, there are four major objects that correspond to a user, a customer, a product and an order. These four objects correspond to the entities User, Customer, Order, and Product. Each entity in the above diagram is described as a rectangular box. Within the implementation, an instance of an entity will represent a line in a table corresponding to that entity. For example, the User entity corresponds to the list of users in the database.
An instance of the entity is composed of many data items. These data items are fields or columns in the table of the entity. To reduce storage costs, only data which cannot be computed at runtime will be stored. Each data items represents an attribute of the entity. Each entity contains one or more attributes which uniquely identifies an instance of the entity, these attributes are called the key attributes or primary keys. The primary keys can be used to retrieve or delete information from the entity table.
The User Entity table contains the following data items:
The primary key of the User entity is the user ID.
The Customer Entity table contains the following data items:
The primary key of the Customer entity is the customer ID.
The Product Entity table contains the following data items:
The primary keys of the Product entity are the product number AND the motif number.
The Order Entity table contains the following data items:
The primary key of the Order entity is the purchase order number.
For the Sales Routing System, there are three relationships between the objects. The relationships are:
In the ERD above, relationships are described in the diamonds. Each diamond corresponds to a table that relates some number of instances of one object to some number of instances of the other. A relationship may be one to one, one to many or many to many. Each line in the table has two or more fields containing the primary key(s) of the instances of the related entities. For example, customer 123 is served by user 321.
The properties of the relationship is served by include:
The properties of the relationship places include:
The properties of the relationship contains include:
The double rectangular box labeled Territory is a weak entity. The weak entity divides the customers into the territories in which they reside. This will ensure that each customer is assigned to a salesperson in that territory. When a new customer is added to the system, the user must explicitly specify the territory in which a customer resides.