You are on page 1of 35

Chapter Four

Entity-Relationship (E-R) diagrams and


Relational Database for AIS
Entity Relationship (E-R) Diagram
 It is a documentation technique used to represent the
relationship between entities.

 Entities are physical resources (automobiles, cash, or


inventory), events (ordering inventory, receiving cash,
shipping goods), and agents (salesperson, customer,
or vendor) about which the organization wishes to
capture data.
Resource- Event –Agent (REA) data model
 What is a model?
 A model is a simplification of something in reality which

is created for a specific purpose.

 We start a model by making a paper-based model with

a set of symbols that have understandable meanings


and for which there are agreed upon procedures for
translation into computer-readable form.

 The paper-based model is a representation of the

business reality
REA model
 REA data model is a framework specifically designed for
building accounting information systems in a shared data
environment based on the E-R diagram technique.

 The REA data model is a conceptual modeling tool


specifically designed to provide structure for designing AIS
data bases.
Database
 Is a set of inter-related, centrally coordinated

files.

 Is a set of computer files that minimizes data

redundancy and is accessed by one or more


application programs for data processing.
IMPORTANCE AND ADVANTAGES OF DATABASE SYSTEMS
 Data integration- Achieved by combining master files
into larger pools of data accessible by many programs
 Data sharing- It’s easier to share data that’s integrated.
 enables all affected data sets to be updated simultaneously
• Minimal data redundancy and inconsistencies- Because
data items are usually stored only once.
• Reporting flexibility- Reports can be revised easily and
generated as needed.
• The database can easily be browsed to research
problems or obtain detailed information.
IMPORTANCE AND ADVANTAGES OF DATABASE SYSTEMS

• Central management of data- Data management is


more efficient because the database administrator is
responsible for coordinating, controlling, and managing
data.

• Data independence- the separation of the data from the


various application programs and other accesses by users.

• Consequently, a data item can be changed without


changing the program and vice versa.
Creating a Database Using REA diagram
 The REA model is an accounting framework for
modeling critical resources, events, agent and
the important relationships between them.

 It permits both accounting/financial and non-


accounting/non-financial/ data to be identified
and stored in a centralized database.

8
Symbols used in E-R/REA diagram
DEVELOPING A REA/E-R DIAGRAM
 Developing a REA diagram for a specific
transaction cycle consists of the following steps:
1. Identify the database entities
2. Identify the relationships and cardinalities b/n
entities
3. Prepare entity relationship REA diagram
4. Identify attributes of database entities
5. Create database tables and records to populate
the database
Identify entities
 Entity is any class of object about which data is
collected.

 REA data model classifies entities in to 3.

 Events

 Resources

 Agents
1. Identify the Event Entities in the REA Model
 Events are phenomena that effect changes
in resources.
 a source of detailed data in the REA approach
to databases
 Events fall into two groups:
 Economic – increases or decreases resources
- impact an organization’s financial statements
 Support /business – control, planning, and
other management activities; but do not
directly affect resources
- impact an organization in a value-added way
 Example: Typical activities/events in the revenue
cycle include:
 Verify availability
 Take customer order
 Ship product
 Bill customer
 Collect payment
2. Identify the Resource and Agent entities
 Resources – the ‘assets’ of the company
 objects of economic value in the give-get exchanges
 REA model does not include some traditional
accounting assets/artifacts / object made by human
that can be generated from other primary data
 for example, accounts receivables
 Identification of resources that are affected by those
events involves determining the resource(s):
 reduced by the give event.
 increased by the get event.
 that are affected by a commitment event.
 Agents can be individuals or departments.
 Participate in events
 Affect resources
 Have discretionary /unrestricted power to
use or dispose of resources
 Can be inside or outside the organization
 Clerks
 Production workers
 Customers
 Suppliers, vendors
 Departments, teams
3. Determine Relationship and Cardinalities between Entities
 Relationship – is an association that exists between
one or more entities based on a key attribute.
 Cardinality – the number of instances/
occurrences/record/raw of one entity can be linked to
a single specific instance/record/raw of another
related entity.
 Cardinalities can be used to create normalized
relational database tables
 Cardinalities – are often expressed as a pair of
numbers. Eg. (0,1), (0,M), (1,1), (1,M)
The first number is the minimum, and the second
number is the maximum.
 Minimum cardinality of a relationship can be either 0 or 1.
 Maximum cardinality of a relationship can be either 1 or N.
 The minimum and maximum cardinalities are not arbitrarily
chosen by the database designer, but are business rules
(policies and procedures).
There are three basic types of relationships between
entities, depending on the maximum cardinality
associated with each entity. They are:
1. A one-to-one relationship (1:1)
2. A one-to-many relationship (1:N)
- is Many to One (1:N) in opposite direction.
3. A many-to-many relationship (M:N)
Example in determining cardinalities
 A given sales transaction can only be linked to one
customer. But a given customer MAY be linked to
many sales events in a given period of time..

(0, N) (1,1)
Sales Made to Customer

18
 The Co. in which you are modeling has a policy of
purchasing the same type of inventory from
multiple suppliers in order to avoid becoming
dependent on a single supplier and in order to get
the best prices. In addition to this each vendor may
supply one or more inventory types to the
company.

(1, N) (1,M)
Vendors Supply Inventories

19
 Assume that a company has 1000 employees, but
only 100 of them are sales staff. Assume also that
each sales person is assigned a company car, but
non-sales staff are not.

(0, N) (1,1)
Employees Assigned Company car

20
Develop REA diagram
 In drawing REA diagram it is useful to divide the paper
in to 3 columns: one column for each type of entity.
 Resources –are placed on the left side
 Events – are placed on the middle
 Agents- are placed on the right side
Develop REA diagram
 Lecture break -1
A sales clerk has sold
 What resources, events
and agents are described inventory to a
in the short sequence of
customer.
events on the right? and
 Draw the REA diagram
REA modeling illustration

Inventory Sales Customer

Notice the elements’ layout.


Salesclerk
Resources on the left, events
in the middle, agents on the
right.
REA modeling illustration
Every “sales” event
involves one to many
inventory items.

(0,*) (1,1)
Inventory (1,*) (0,*) Sales Customer

(0,*)

Every inventory item (1,1)


can be involved in
zero to many “sales” Sales clerk
events.
REA modeling illustration
 Lecture break -2
The preceding REA model explains the cardinalities
between “inventory” and “sales.” and

Explain the remaining cardinalities in the model using


similar language.
Relational database design
 Principles
 When the maximum cardinalities between two elements

are 1 and many, include the primary key from the “1 side”
in the table on the “many side.”

 When the maximum cardinalities between two elements

are many and many, create a junction table in addition


to the separate tables for the elements.
 Never store derivable data.
Create database tables and Identify attributes of each
table to populate the database
 Needed tables based on previous REA model
 Inventory table
 Customer table
 Sales clerk table
 Sales table
 Sales-inventory table
Relational database design
 Inventory table design attributes
 Inventory ID
 Description
 Beginning quantity on hand
 Beginning quantity The underline
 Price per unit indicates the
 Cost per unit table’s primary
key.
Relational database design
 Customer table design attributes
 Customer ID
 Customer last name
 Customer first name Lecture break 8-3
 Customer street address •What additional fields
 Customer city would you need in this
 Customer state table?
•Create specs for the
“order clerk” table.
Relational database design
 Sales table design attributes
 Sales Invoice number
Brackets indicate foreign keys.
 [Customer ID]
Remember the principle: When
 [Sales person ID]
the maximum cardinalities
 Sales date between two elements are 1
and many, include the primary
key from the “1 side” in the
table on the “many side.”
Relational database design
 Sales table design attributes
 Sales Invoice number
Any individual sales can include
 [Customer ID]
“many” inventory items. So,
 [Sales person ID]
this table includes no data
 Sales date about inventory items, as there
is no way to determine how
many fields would be needed
for them.
Relational database design
 Sales/ inventory attributes
 [Sales Invoice number] This junction table is necessary
 [Inventory ID] because of the second design
 Quantity sold principle: When the maximum
cardinalities between two
elements are many and many,
create a junction table in addition
to the separate tables for the
elements.
Relational Data Tables
Relational Data Tables

Primary Keys

Foreign Key (Customer # is a Foreign


key in the Sales Table because it is a
Primary key that uniquely identifies
Customers in the Customer Table).
Because of this, the Sales Table can relate
to the Customer Table (see red arrow
above).
Why Have a Set of Related Tables?
 Data stored in one large table can be redundant and
inefficient causing the following problems:
 Update anomaly- results from data redundancy in an
unnormalized table.
 Insert anomaly- eg. Adding a new vendor to the
database for future purchase
 Delete anomaly- involves the unintentional deletion
of data from a table.

You might also like