AIS Chapter 4
AIS Chapter 4
AIS Chapter 4
Relational Database
2022 Bereket N.
FILE Vs DATABASES
• Database systems were developed to
address the problems associated with the
proliferation of master files.
–For years, each time when a new
information need arose, companies
create new files and programs.
–The result: a significant increase in the
number of master files.
FILE Vs DATABASES
• This proliferation of master files
creates problems:
– Often the same information
Master File 1 was stored in multiple master
Enrollment
Fact A
Fact B
Program files.
Fact C – Made it more difficult to
effectively integrate data and
obtain an organization-wide
Master File 2
Fact A Fin. Aid view of the data.
Fact D Program
– Also, the same information may
Fact F not have been consistent
between files.
Master File 3 e.g. If a student changed his
Grades
Fact A Program phone number, it may have
Fact B been updated in one master file
Fact F
but not another.
FILE Vs DATABASES
Database
Fact A Fact B
• Database systems
Fact C Fact D
Fact E Fact F
were developed to
address the above
Database stated problems
Management
System
11
Each row is called a tuple.
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555
12
Each row contains data about a specific
occurrence of the type of entity in the table.
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555
13
Each column in a table contains information
about a specific attribute of the entity.
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555
14
Attributes
• Primary Key
– An attribute or combination of attributes that
can be used to uniquely identify a specific row
(a record) in a table.
– For example, Student ID in the students’ table
& Item Number in the inventory table.
• Foreign Key
– An attribute in one table that is a primary key
in another table.
• Used to link the two tables
15
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555
16
STUDENTS
First Advisor
Student ID Last Name Name Phone No. No.
333-33-3333 Simpson Alice 333-3333 1418
111-11-1111 Sanders Ned 444-4444 1418
123-45-6789 Moore Artie 555-5555 1503
ADVISORS
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Melton Amy 316
1503 Zhang Xi 202
1506 Radowski J.D. 203
ADVISORS
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Melton Amy 316
1503 Zhang Xi 202
1506 Radowski J.D. 203
ADVISORS
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Melton Amy 316
1503 Zhang Xi 202
1506 Radowski J.D. 203
22
Cont…
• Accountants may provide the greatest value by
taking responsibility for data modeling — the
process of defining a database to faithfully
represent all aspects of the organization, including
interactions with the external environment.
– Occurs during both system analysis and
conceptual design stage.
– Two important tools to facilitate data modeling:
• Entity-relationship diagramming
• REA data model (Resource, Event, and
Agent)
23
ENTITY-RELATIONSHIP DIAGRAMS
• An entity-relationship (E-R)
diagram is a graphical technique
for portraying (depicting) a
database schema (DB Design in the
picture).
–Shows the various entities being
modeled and the important
relationships among them.
24
Cont…
• 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. 25
Cont…
Enrollment Students
26
Cont…
• Some data modelers, tools, and authors use
diamonds to depict relationships.
Line
Enrollment Items Students
27
Cont…
• Others do not use diamonds.
Enrollment Students
28
Cont…
• Sometimes the attributes associated with each
entity are depicted as named ovals connected to
each rectangle.
Student
Enrollment Student Name
Number Enrollment ID No.
Date
Student
Address
Enrollment
Time
Enrollment Students
29
Cont…
• Sometimes these attributes are listed in a
separate table.
Enrollment Students
30
Cont…
• E-R diagrams can be used to represent
the contents of any kind of database.
• 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.
31
Cont..
• 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.
32
Cont…
• An important step in designing a
database is deciding which entities
need to be modeled.
33
THE REA DATA MODEL
• The REA data model was developed
specifically for use in designing
accounting information systems.
–Focuses on business semantics
underlying an organization’s value
chain activities.
–Provides guidance for:
• Identifying the entities to be
included in a database.
• Structuring the relationships
among the entities.
34
Cont.…
• REA data models are usually
depicted in the form of E-R
diagrams.
35
Cont…
• Three basic types of entities
– The REA data model is so named because it
classifies entities into three distinct categories:
• Resources that the organization acquires and uses.
Resources are things that have economic value to the
organization.
• Events in which the organization engages. These are the
various business activities about which management wants
to collect information for planning or control purposes.
• Agents participating in these events. Includes people and
organizations who participate in events and about whom
information is desired for planning, control, and evaluation
purposes.
36
Cont…
• Can you identify the resources in this diagram?
• Can you identify the events in this diagram?
• Can you identify the agents in this diagram?
Customer
Cash Receive
Employee
Accounts Cash
37
Cont…
• Structuring relationships: The basic
REA template
38
Cont…
• Rule 1: Each event is linked to at least one resource
that it affects.
Resource A Event A
Resource B Event B
39
Cont…
• Rule 2: Each event is linked to at least one other
event.
Resource A Event A
Resource B Event B
40
Cont…
• Rule 3: Each event is linked to at least two
agents.
Agent B
45
Cont…
Take customer order Bill customer
• Taking an order • Printing and mailing invoices
requires that we set does not directly affect an
economic resource.
resources aside.
• It does not represent a
• That information commitment on the part of
should be included in the company to a future
our model. exchange.
• It is an information retrieval
event and should not alter the
contents of the database.
• Does not need to be included
in the model.
46
Cont…
47
Cont…
Take Order
Sale
Receive
Cash
48
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.
49
Cont…
• In order to identify the resources that are affected by the
relevant events identified above the following questions
may be raised:
– What is the give event?
Sale
– What resource is reduced by the give event?
Inventory
– What is the get event?
Receive Cash
– What resource is increased by the get event?
Cash
– Is there a commitment event?
Take Order
– What resource is affected by the commitment event?
Inventory
50
Cont…
Take Order
Inventory
Sale
Receive
Cash
Cash
51
Cont…
• 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.
52
Cont…
• In order to identify the agents who participate
in each event identified above the following
questions may be raised:
– What agents are involved in the sale?
Employee and Customer
– What agents are involved in the receipt of
cash?
Employee and Customer
– What agents are involved in taking the order?
Employee and Customer
53
Cont…
Inventory
Customer
Sale
Employee
Receive
Cash Customer
Cash
54
STEP THREE: DETERMINE
CARDINALITIES OF RELATIONSHIPS
• 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:
• For each sale a company makes, how many
customers are associated with that sale?
55
Cont…
• Unfortunately, there is no universal
standard for diagramming
cardinalities.
• In this chapter, we adopt the graphical
“crow’s feet” notation style because:
– It is becoming increasingly popular.
– It is used by many software design tools.
56
Cont…
• 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:
57
Cont…
• There is typically a minimum and
maximum cardinality for each entity
participating in a relationship.
– The minimum cardinality can be either
zero or one.
– The maximum cardinality can be either
one or N (many).
58
Cont…
59
Cont…
• A one-to-one relationship (1:1) exists when the
maximum cardinality for each entity in the
relationship is one.
Take Order
• Both maximums are
one, so this is a one-to-
one relationship.
Sale
60
Cont…
• A one-to-many (1:N) relationship exists when the
maximum cardinality on one side is one and the
maximum on the other side is many.
Sale Customer
Inventory Sale
63
Cont.…
• Customers pay for each
Sale sale with a maximum of
one payment (typical
for retail stores).
• Each cash receipt from
Cash Receipt
a customer relates to
one (and only one) sale.
• The relationship
between sales and cash
receipts is 1:1.
64
Cont.…
67
Cont.…
68
The End!
69