Database Design Using The REA Data Model
Database Design Using The REA Data Model
Introduction
ENTITY-RELATIONSHIP DIAGRAMS
An entity-relationship (E-R) diagram is a graphical technique for portraying a database
schema.
– Shows the various entities being modeled and the important relationships among
them.
An entity is anything about which the organization wants to collect and store information.
– Example: Your university collects and stores information about students, courses,
enrollment activity, etc.
In a relational database, separate tables would be created to store information about each
distinct entity.
In an object-oriented database, separate classes would be created for each distinct entity.
In an E-R diagram, entities are depicted as rectangles.
But there are no industry standards for other aspects of these diagrams.
Enrollment Students
Some data modelers, tools, and authors use diamonds to depict relationships.
Sometimes the attributes associated with each entity are depicted as named ovals connected
to each rectangle.
E-R diagrams can be used to represent the contents of any kind of databases.
Our focus is on databases designed to support an organization’s business activities.
The diagrams we develop depict the contents of a database and graphically model those
business processes.
In addition to their use in designing databases, E-R diagrams can be used to:
– Document and understand existing databases.
– Reengineer business processes.
In this chapter, we’ll use E-R diagrams for designing new databases and understanding
existing ones.
E-R diagrams can include many different kinds of entities and relationships.
An important step in designing a database is deciding which entities need to be modeled.
The REA data model is useful for this decision.
Resource A Event A
Resource B Event B
o Rule 2: Each event is linked to at least one other event.
Resource A Event A
Resource B Event B
At a minimum, every REA model must include the two events that represent the basic “give-
to-get” economic exchange performed in that transaction cycle.
The give event reduces one of the organization’s resources.
The get event increases a resource.
There are usually other events that management is interested in planning, controlling, and
monitoring. These should be included in the model.
Example: Typical activities in the revenue cycle include:
– Take customer order
o Taking the customer order does not involve giving or taking a resource. It
is a commitment event.
o Taking an order requires that we set resources aside.
o That information should be included in our model.
– Fill customer order
o Filling the order involves a reduction in the company’s inventory. It is a
give event.
o The give-to-get, then, is:
Fill customer order (often referred to as “sale”);
Collect cash (often referred to as “cash receipt”).
– Bill customer
o Billing customers involves the exchange of information with an external
party but does not affect resources.
o Printing and mailing invoices does not directly affect an economic
resource.
o It does not represent a commitment on the part of the company to a future
exchange.
o It is an information retrieval event and should not alter the contents of the
database.
o Does not need to be included in the model.
– Collect payment
o Collecting payment results in an increase in cash. It is a get event.
o
Although accounts receivable is an asset in financial reporting, it is not represented as a
resource in an REA model.
– It represents the difference between total sales to a customer and total cash
collections from the customer.
– The information to calculate an account receivable balance is already there
because the sales and cash receipt information is captured.
Events that pertain to “entering” data or “re-packaging” data in some way do not appear on
the REA model.
– They are not primarily value-chain activities.
– What is modeled is the business event and the facts management wants to collect
about the event, not the data entry process.
In completing the first step of an REA diagram, the event entities are typically drawn from
top to bottom in the sequence in which they normally occur.
STEP TWO: IDENTIFY RESOURCES AND AGENTS
When the relevant events have been diagrammed in the center of the REA diagram, the
resources that are affected by those events need to be identified.
Involves determining:
– The resource(s) reduced by the give event.
– The resource(s) increased by the get event.
– The resources that are affected by a commitment event.
The agents who participate in each event should also be identified.
– There will always be at least one internal agent (employee).
– In most cases, there will also be an external agent (e.g., customer or supplier) who
participates.
The final step in an REA diagram for a transaction cycle is to add information about the
relationship cardinalities.
A cardinality describes the nature of the relationship between two entities.
– It indicates how many instances of one entity can be linked to a specific instance
of another entity.
– For example, the cardinality between the event Sales and the agent Customer
answers the question:
o For each sale a company makes, how many customers are associated with
that sale?
Unfortunately, there is no universal standard for diagramming cardinalities.
In this text, we adopt the graphical “crow’s feet” notation style because:
– It is becoming increasingly popular.
– It is used by many software design tools.
Using the crow’s feet notation:
– The symbol for zero is a circle: O
– The symbol for one is a single stroke:
– The symbol for many is the crow’s foot:
Three types of relationships
– Three types of relationships are possible between entities.
– Relationships depend on the maximum cardinality on each side of a relationship.
o A one-to-one relationship (1:1) exists when the maximum cardinality for
each entity in the relationship is one.
• It reflects facts about the organization that are obtained during the requirements definition
stage of the database design process.
• Now let’s go back to the REA diagram for the revenue cycle and see if we can complete the
cardinalities.
• In relationships between events and agents:
– For each event that occurs, the cardinality between event and agent is typically
(1:1).
• There is usually one and only one salesperson. This practice makes it more
feasible for the organization to establish employee accountability for the
event.
For each agent the cardinality between agent and event is typically (0:N).
– Example: For a particular salesperson:
o There is typically a minimum of zero sales (allows for inclusion of a new
salesperson who has not yet made any sales).
o A salesperson can have a maximum of many sales.
– Or: For a particular customer:
o There is typically a minimum of zero sales (to allow for the inclusion of
prospective customers who haven’t bought anything yet) and a maximum
of many sales.
In the cardinality between event and resource, the maximum is typically many.
– Most inventory items can be sold many times. (An exception might occur if each
inventory item is one unique item, such as a piece of real estate.)
– The company’s cash account can have many cash receipts.
Finally, let’s look at the relationships between events.
When events occur in a sequence, the minimum cardinality between the first event and the
second event is always zero, because there is a span of time (although possibly quite short)
when the first event has occurred but there are zero occurrences of the second event.
Examples:
– When an order is first taken, there have been no deliveries of goods (sale event) to
the customer.
– When goods are delivered to the customer, there is a span of time, however brief,
in which there is no cash receipt from the customer.
The minimum cardinality between the second event and the first event is typically one,
because the second event can’t occur without the first event having occurred.
An exception could occur if the first event is not required for the second event to occur.
Example: If a sale can be made without first taking an order, then the minimum cardinality
between sale and take order could be zero.
The maximums in the cardinalities between events can be either one or many, and these
maximums vary based on business practices.
We saw this when we looked at the four different possibilities for the relationships between
sales and cash receipts previously.
On the following slides, see if you can explain the maximums between the three events.