You are on page 1of 55

Chapter 7

RELATIONAL Data Base


and
REA Modeling
Types of Files
• Two basic types of files are used to store data.
1 The master file, which is conceptually similar to
a ledger in a manual system.
2 The transaction file, which is conceptually similar
to a journal in a manual system.

5-2
File Approach
• For many years, companies created new files and
programs each time an information need arose.
• This proliferation of master files created problems:
1 Often the same data was stored in two or more
separate files.
2 The specific data values stored in the different files
were not always consistent.

5-3
File-Oriented Approach
File 1
Fact A Sales
Fact B Program
Fact C
File 2
Fact B Shipping
Fact D Program
Fact E
File 3
Fact A Billing
Fact G Program
Fact E 5-4
Databases
• The database approach views data as an
organizational resource that should be used by, and
managed for, the entire organization, not just the
originating department or function.
• Its focus is data integration and data sharing.
• Integration is achieved by combining master files into
larger pools of data that can be accessed by many
application programs.

5-5
Databases
• Database management system (DBMS) is
the program that manages and controls
access to the database.
• Database system is the combination of the
database, the DBMS, and the application
program that uses the database.
• Database administrator (DBA) is the
person responsible for the database.

5-6
DATABASES
Database • The combination of
Fact A Fact B
Fact C Fact D the database, the
Fact E Fact F
DBMS, and the
application programs
Database
Management
that access the
System database is referred
to as the database
Enrollment
Program
Financial Aid
Program
Grades
Program
system.

5-7
Database Approach
Database Sales Program

Fact A
Database
Fact B Shipping
management
Program
Fact C system
Fact D
Fact E Billing
Program

5-8
Relational Databases
• Databases differ in the type of data model
they are designed with
• A data model is an abstract representation
of the contents of a database.
• The relational data model represents
everything in the database as being stored in
the form of tables.
• Technically, these tables are called relations.

5-9
Relational Databases
• Each row in a relation, called a tuple, contains
data about a specific occurrence of the type of
entity represented by that table.

5-10
IMPORTANCE AND ADVANTAGES OF DATABASE
SYSTEMS
• Database technology provides the following
benefits to organizations:
– Data integration
– Data sharing
– Reporting flexibility
– Minimal data redundancy and inconsistencies
– Data independence
– Central management of data
– Cross-functional analysis
5-11
Logical and Physical
Views of Data
• A major advantage of database systems over
file-oriented systems is that the database
systems separate the logical and physical view
of data.
• What is the logical view?
– It is how the user or programmer conceptually
organizes and understands the data.

5-12
Logical and Physical
Views of Data
• What is the physical view?
– It refers to how and where the data are physically
arranged and stored on disk, tape, CD-ROM, or other
media.
• The DBMS controls the database so that users
can access, query, or update it without reference
to how or where the data are physically stored.
• Program-data independence is the separation of
the logical and physical views of data.
5-13
Logical and Physical
Views of Data

Logical View User A Logical View User B


Past Due Accounts October Sales by Region
Name Balance Days
Jackson 2145 48
Houston 1595 65

Database
Operating
DBMS system

5-14
Schemas
• A schema describes the logical structure of a
database.
• There are three levels of schemas:
1 Conceptual-level schema
2 External-level schema
3 Internal-level schema

5-15
Schemas
The conceptual-level schema is an
organization-wide view of the entire
database.
The external-level schema consists of
a set of individual user views of
portions of the database, also referred
to as a subschema.
The internal-level schema provides a
low-level view of the database.

5-16
Schemas

Subschema A Subschema B Subschema C


r r
Jackson 210 xxxxxxx
Houston 100 xxxxxxx

Mapping external level views to conceptual level schema

Inventory Sales Customer

Cash receipt
5-17
Schemas

Inventory Sales Customer

Cash receipt
Mapping conceptual level facts to internal level descriptions

Inventory Record
Item number – integer (5), non-null, index =
itemx Description – character (15)
5-18
Basic Requirements of the Relational
Data Model
1. Each column in a row must be single valued.
2. Primary keys cannot be null.
3. Foreign keys, if not null, must have values that
correspond to the value of a primary key in an
other relation.
4. All non-key attributes in a table should describe a
characteristic about the object identified by the
primary key.

5-19
Approaches to Database Design
• Normalization
– Starts with the assumption that all data is initially stored in
a large non-normalized table.
– This table is then decomposed using a set of normalization
rules to create a set of tables in the Third Normal Form.
• Semantic Data Modeling
– The database designer uses his/her knowledge about the
business structure to create a set of relational tables.

5-20
Database Systems and the
Future of Accounting
• Database systems may profoundly affect the
fundamental nature of accounting:
– May lead to abandonment of double-entry
accounting, because the redundancy of the double
entry is not necessary in computer data processing.
– May also alter the nature of external reporting.
• EXAMPLE: External users could have access to the
company’s database and manipulate the data to
meet their own reporting needs.

5-21
DATABASE SYSTEMS AND THE FUTURE OF
ACCOUNTING
• The use of accounting information in decision making
will be enhanced by:
– Powerful querying capabilities that accompany
database packages.
– The ability to accommodate multiple views of the
same underlying phenomenon.
– The ability to integrate financial and operational
data.

5-22
DATABASE SYSTEMS AND THE FUTURE OF
ACCOUNTING…
• Accountants must become knowledgeable about
databases so they can participate in developing the
AIS of the future.
• They must help ensure that adequate controls are
included to safeguard the data and assure its
reliability.

5-23
Designing and Implementing a
Database System
• Six basic steps in designing and
implementing a database system:
1. Initial planning to determine the need
for and feasibility of developing a new
system (planning stage).
2. Identifying user needs (requirements
analysis stage).
3. Developing the contextual-, external-
and internal- level schemas (design
stage).

5-24
4. Translating the internal-level schema into the
actual database structures that will be
implemented in the new system (Coding, new
application development stage).

5. Transferring all data from the existing system


to the new database (Implementation, testing,
and training stage).

6. Using and maintaining the new system


(Operation, maintenance, monitoring system
performance, enhancement and modifications
stage).

5-25
Data Modeling
• Accountants may provide the greatest value to their
organizations by taking responsibility for data
modeling.

• Data modeling is the process of defining a database so


that it faithfully represents all aspects of the
organization, including its interactions with the
external environment.

• Data modeling occurs during both the requirements


analysis and design stages of database design.
5-26
Data Modeling in the Database Design Process

Operation and
Planning
Maintenance

Data Requirements
Implementation
Modeling Analysis
Occurs
Here
Design Coding
5-27
Data Modeling Tools

• Two important tools that accountants can use to


facilitate participation in data modeling are:

A. Entity Relationship Diagramming (E-R Diagram).

B. The REA Model.

5-28
A. ENTITY-RELATIONSHIP DIAGRAM
(E-R Diagram)
• An Entity-Relationship (E-R) diagram is a ‘Graphical
Technique’ for portraying a database schema.

• It is called an E-R diagram because it 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.

• In an E-R diagram, entities appear as rectangles, and


relationships between entities are represented as
diamonds.
5-29
Sample E-R Diagrams

Employees Manage Supervisors

Part of
Manages

Departments

Customer Lead Cash


Orders
To Sales Lead To
Receipts

Players Part of Teams Part of League

5-30
• An E-R diagram not only depicts the contents of a
database, but also graphically models an organization.

• Thus, E-R diagrams can be used not only to design


databases, but also to document and understand existing
databases and to reengineer business processes.

• E-R diagrams can include many different kinds of entities


and relationships among those entities.

• An important step in database design, therefore entails


deciding which entities need to be modeled.

• The REA data model is useful for making that decision.


5-31
B. THE REA DATA MODEL
• The REA (Resources, Events, Agents) data model is a
conceptual modeling tool that focuses on the business
semantics underlying an organization’s value chain
activities.

• The REA data model provides guidance for database


design in two ways:
1. By identifying what entities should be included in the
AIS database
2. By prescribing how to structure relationships among
the entities in the AIS database.
5-32
Types of Entities

• An entity is any class of objects about which data is


collected.

• The REA data model classifies entities into three


distinct categories:
1. The Resources acquired and used by an
organization
2. The Events (Business Activities) engaged in by the
organization
3. The Agents participating in these events

5-33
THE REA DATA MODEL
• Can you identify the resources, events & agents in this
diagram?

Inventory Sales Employee

Customer

Cash Receive
Employee
Accounts Cash
5-34
A. Resources:
 Resources are those things that have economic value
to the organization.

 What are some examples?


 Cash
 Inventory
 Machinery & Equipment
 Warehouses
 Land
 Factories

5-35
B. Events:
 Events are the various business activities about which
management wants to collect information for planning or control
purposes.

 Most of the events in an REA data model fall into one of two
categories:
 Economic exchanges (the sales event decreases the quantity
of inventory and the Cash receipt event increases the
amount of cash)
 Commitments (Customer orders are commitments that lead
to future sales)

 What are some examples?


 Sales events
 Taking customer orders
 Cash Receipts
5-36
C. Agents:

 Agents are the third type of entity in the REA model.

 Agents are the people and organizations that


participate in events and about whom information is
desired for planning, control, and evaluation
purposes.

 What are some examples?


 Employees (Sales person, Cashier).
 Customers.
Suppliers / Vendors.

5-37
Developing an REA Diagram
• Developing an REA diagram for a specific transaction
cycle consists of four steps:

1. Identify the pair of events that represent the basic


give-to-get economic duality relationship in that cycle.
2. Identify the resources affected by each event and the
agents who participate in those events.
3. Analyze each event to determine whether it should be
decomposed into a combination of one or more
commitment events and an economic exchange event.
4. Determine the cardinalities of each relationship.
5-38
Basic REA Template

Resource A GET
Inflow Participant Internal Agent
Resource A

Participant External Agent

Economic
Duality

Participant External Agent

GIVE
Resource B Outflow Participant Internal Agent
Resource B

5-39
SAMPLE REA DIAGRAM

Inventory Stock-flow Sales Participant Salesperson

Participant

Economic
Customer
Duality

Participant

Cash
Cash Stock-flow Participant Cashier
Receipts

5-40
Step-1: Identify Economic Exchange Events

• In drawing an REA diagram for an individual cycle, it is useful


to divide the paper into three columns, one for each type of
entity.
 Left column should be used for resources.
 Middle column should be used for events.
 Right column should be used for agents.

• The basic economic exchange in the revenue cycle involves


the sale of goods or services and the subsequent receipt of
cash in payment for those sales.

• The REA diagram for revenue cycle shows the drawing of


sales and cash receipts events entities as rectangles and the
relationship between them as a diamond.

5-41
Step-2: Identify Resources and Agents

• Once the events of interest have been specified, the


resources that are affected by those events need to be
identified.

• The sales event involves the disposal of inventory and the


cash receipts event involves the acquisition of cash.

• After specifying the resources affected by each event, the


next step is to identify the agents who participate in those
events.

• There will always be at least one internal agent (employee)


and, in most cases, an external agent (customer).

5-42
Step-3: Include Commitment Events

• The third step in drawing an REA diagram is analyzing


each economic exchange event to determine whether
it can be decomposed into a combination of one or
more commitment exchange events.

• Example: The sales event may be decomposed into


the ‘take-order’ commitment event and the ‘deliver-
order’ economic exchange event.

5-43
Decomposing Sales into Orders and
Sales

Customer
Inventory- (1,N) (1,1) Participant (0,N) Customer
Orders
Orders

(0,N) (1,1)

(0,1) Participant

(0,N)
Inventory- Leads to
Inventory (0,N) Salesperson
Sales (0,N)

(0,1)
(1,N)
Participant

(1,1)
Sales

(1,1) Participant (0,N) Customer

5-44
Step-4: Determine Cardinalities

• Entities represent a class or set of objects.

• Ex.: The customer entity represents all of the


organization’s customers and the sales entity
represents all the individual sales transactions that
occur during the current fiscal period.

• Each individual customer or sales transaction


represents a specific instance of that entity.

5-45
• Cardinalities indicate how many instances of one
entity can be linked to one specific instance of another
entity.

• For example, cardinalities indicate how many sales


transactions can be linked to each individual customer,
and conversely, how many customers can be linked to
each individual sales transaction.

• In a relational database, each entity is a table and each


instance is a row in that table.
• Therefore, in relational databases, cardinalities
indicate how many rows in one table can be linked to
each row in another table.
5-46
• Cardinalities are often expressed as a pair of
numbers.

• The first number is the minimum cardinality, and


the second number is the maximum cardinality.

• It indicates whether a row in this table must be


linked to at least one row in the table on the
opposite side of that relationship.

• Minimum cardinalities can be either 0 or 1.


5-47
• A minimum cardinality of zero means that a new row can
be added to that table without being linked to any rows in
the other table.

• A minimum cardinality of 1 means that each row in that


table must be linked to at least one row in the other table.

• The minimum cardinality of zero in the (0, M) cardinality


pair to the left of the customer entity in the customer-sales
relationship indicates that a new customer may be added
to the database without being linked to any sales events.

(0, M)
Sales Made to Customer

5-48
• The maximum cardinality of M in the (0, M)
cardinality pair to the left of the customer entity in
the customer-sales relationship indicates that a given
customer may be linked to many sales events.

(0, M)
Sales Made to Customer

5-49
• The minimum cardinality of 1 in the (1, 1) cardinality
pair to the right of the sales entity in the customer-
sales relationship indicates that a new sales
transaction can only be added if it is linked to a
customer.

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

5-50
• The maximum cardinality of 1 in the (1, 1) cardinality
pair to the right of the sales entity in the customer-
sales relationship indicates that a given sales
transaction can only be linked to one customer.

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

5-51
Entity Association

5-52
Relationships
between Entities
• Three basic types of relationships between
entities are possible, 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:M)
3. A many-to-many relationship (M:M)

5-53
Implementing an REA Diagram in a
Relational Database

• An REA diagram can be used to design a well-


structured relational database.

• A well-structured relational database is one


that is not subject to update, insert, and
delete anomaly problems.

5-54
end

5-55

You might also like