0% found this document useful (0 votes)
10 views59 pages

Chapter 4

Chapter Four discusses the fundamentals of database systems, focusing on relational databases and data modeling. It highlights the differences between databases and file-based systems, the importance of databases, and key concepts such as DBMS, schemas, and data dictionaries. Additionally, it explains the structure of relational databases, including primary and foreign keys, and the advantages of using a set of tables to minimize data redundancy and anomalies.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views59 pages

Chapter 4

Chapter Four discusses the fundamentals of database systems, focusing on relational databases and data modeling. It highlights the differences between databases and file-based systems, the importance of databases, and key concepts such as DBMS, schemas, and data dictionaries. Additionally, it explains the structure of relational databases, including primary and foreign keys, and the advantages of using a set of tables to minimize data redundancy and anomalies.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 59

1

Chapter Four

Database System ,
Relational Database
and Data Modeling
Introduction
2

 Questions to be addressed in this chapter:


 How are databases different than file-based systems?
 Why are databases important and what is their advantage?
 What is the difference between logical and physical views of a database?
 What are the fundamental concepts of database systems such as DBMS,

schemas, the data dictionary, and DBMS languages?


 What is a relational database, and how does it organize data?
 How are tables structured to properly store data in a relational database?
Relational Databases
3

 Relational databases underlie (basis)


most modern integrated AISs.
 They are the most popular type of
database used for transaction
processing.
 In this chapter, we’ll define the concept of

a database.
DATABASES

Database
 A database is a set
Fact A Fact B
Fact C Fact D
of inter-related,
Fact E Fact F
centrally
coordinated files.
Database
Management
System

Enrollment Financial Aid Grades


Program Program Program
DATABASES
 The database approach
Database treats data as an
Fact A Fact B
Fact C Fact D
organizational resource
Fact E Fact F that should be used by
and managed for the
entire organization, not
just a particular
Database department.
Management
System
 A database
management system
(DBMS) serves as the
Enrollment Financial Aid Grades
interface between the
Program Program Program database and the
various application
programs.
DATABASES

Database
 The combination of
Fact A Fact B
Fact C Fact D
the database, the
Fact E Fact F
DBMS, and the
application
Database programs that
Management
System
access the
database is
referred to as the
Enrollment Financial Aid Grades
Program Program Program database
system.
DATABASES
 The person
Database
Fact A Fact B responsible for the
Fact C Fact D
Fact E Fact F database is the
database
administrator.
Database
Management
 As technology
System improves, many
large companies
are developing very
Enrollment Financial Aid Grades
Program Program Program large databases
called data
warehouses.
Database
8

 It is a set of inter-related, centrally


coordinated files.
 A database management system (DBMS)
serves as the interface between the
database and the various application
programs.
 The combination of the database, DBMS,
and the application programs that access
the database is referred to as the database
system.
 Database technology provides the following
Cont’d………
9

 Reporting flexibility: Reports can be


revised easily and generated as needed.
 Minimal data redundancy and
inconsistencies: data items are usually
stored only once.
 Data independence: Data items are
independent of the programs that use them.
 Central management of data: Data
management is effective b/c database
administrator is responsible for
coordinating, controlling and managing
data.
Logical and Physical Views of Data
10

 Database systems separate the logical


and physical views of data.
 Logical view of data refers to how the
user or programmer conceptually
organize and understand the data.
 Example, a sales manager may
conceptualize all information about
customers as being stored in the form of
a table.
 Physical view of data refers to how and
where the data are physically arranged
Schemas
11

 Schema (diagram) describes the logical


structure of a database.
 There are three levels of schemas:
 Conceptual level schema,
 External level schema, and
 Internal level schema
 conceptual level schema is the
organization-wide view of the entire
database.
 It lists all data elements and the
relationships between them.
Cont’d……….
12

 External level schema consists of a set of


individual user views of portions of the
database, each of which is also referred to
as a sub-schema.
 Internal level schema provides a low-level
view of the database.
 It describes how the data are actually

stored and accessed, including


information.
Smith . . . A
Jones . . . B
Arnold . . .D

13
Mapping external-level views to conceptual-level schema

Classes Enroll Student

Cash
Receipt

Mapping conceptual-level items to internal-level descriptions


Student Record Class Record
Student No. --character [9] Class Name --character [9]
Student Name --character [26] Dept No. --integer [4], non-null, index=itemx
SAT Score --integer [2], non-null, index=itemx Course No. --integer [4], non-null, index=itemx
Data Dictionary
14
 A key component of a DBMS is the data
dictionary, contains information about
structure of the database.
 For each data element stored in the
database, such as the customer number,
there is a corresponding record in the data
dictionary describing it.
 One of the first applications of a newly
implemented database system.
 Inputs to the data directory include records

of new or deleted data elements, changes in


names, descriptions, or uses of existing data
DBMS Languages
15

 Every DBMS must provide a means of


performing the three basic functions:
 Creating,
 Changing, and
 Querying the database

 The set of commands used to perform these


functions are;
 Data definition,
 Data manipulation, and
 Data query languages respectively.
Cont’d………
16

 Data definition language (DDL) uses to:


 Build the data directory
 Initialize or create the database
 Describe the logical views for each user or

programmer
 Specify any limitations or constraints on

security imposed on database records or


fields
 Data manipulation language (DML) uses
for:
 Data maintenance such as updating,
inserting and deleting portions of the
Cont’d………
17
 Data query language (DQL):
 Used to interrogate (examine/question) the

database.
 Saves record, categories record, orders
record, and presents subsets of the database
in response to user queries.
 Contain powerful, but easy to use, set of

commands that enables users to satisfy their


information needs, without the programmer's
assistance.
 Many DBMSs also include a report writer,

which is a language that simplifies report


RELATIONAL DATABASES
• The relational data model represents
everything in the database as being stored in
the forms of tables (aka, relations).
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333
Relation
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555

COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30

STUDENT x COURSE
SCID Student ID Course
333333333-1234 333-33-3333 1234
333333333-1236 333-33-3333 1236
111111111-1235 111-11-1111 1235
111111111-1236 111-11-1111 1235
Cont’d………
20

 Relational database tables have three types


of attributes (elements/characteristics):
 Primary key
 Foreign key
 Other non-key attributes

 Primary key is the attribute or combination


of attributes that uniquely identifies a specific
row in a table.
 Often, the primary key is a single
attribute.
 In some tables however, two or more
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

COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT x COURSE
A primary key is the
SCID
attribute or combination
333333333-1234 of attributes that
333333333-1236 uniquely identifies a
111111111-1235 specific row in a table.
111111111-1236
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

COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT x COURSE
SCID
333333333-1234 In some tables, two or more attributes
333333333-1236 may be joined to form the primary key.
111111111-1235
111111111-1236
Cont’d……..
23

 Foreign key is an attribute appearing in


one table that is a primary key in another
table.
 Foreign keys are used to link tables.

 Other non-key attributes - in each


table store important information about
that entity.
 Example, in the inventory table,
quantity on hand, description and list
price are non-key attributes.
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

A foreign key is an attribute in one table that is a primary key in


another table.
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

Foreign keys are used to link tables together.


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

Other non-key attributes in each table store important


information about the entity.
Cont’d………
27

Basic Requirements of the Relational Data


Model
 Every column in a row must be single

valued - there shall be one and only one


value in each cell.
 Primary keys cannot be null - A non-null

value for primary key indicates that a specific


object exists and can be identified by
reference to its primary key value, referred to
as the entity integrity rule.
 Foreign keys must have values that match to

the value of the primary key in another


Cont’d………
28

Problems associated with storing all


Data in one table
 It creates data redundancy.

 It makes file maintenance unnecessarily

time consuming and error prone.


 Three specific types of problems can
occur:
 Update anomaly
 Insert anomaly
 Delete anomaly
Last First
Student ID Name Name Phone No. Course No. Section Day Time
333-33-3333 Simpson Alice 333-3333 ACCT-3603 1 M 9:00 AM
333-33-3333 Simpson Alice 333-3333 FIN-3213 3 Th 11:00 AM
333-33-3333 Simpson Alice 333-3333 MGMT-3021 11 Th 12:00 PM
111-11-1111 Sanders Ned 444-4444 ACCT-3433 2 T 10:00 AM
111-11-1111 Sanders Ned 444-4444 MGMT-3021 5 W 8:00 AM
111-11-1111 Sanders Ned 444-4444 ANSI-1422 7 F 9:00 AM
123-45-6789 Moore Artie 555-5555 ACCT-3433 2 T 10:00 AM
123-45-6789 Moore Artie 555-5555 FIN-3213 3 Th 11:00 AM

• Using the suggested approach, a student taking three classes would


need three rows in the table.
• In the above, simplified example, a number of problems arise.
30

The Solution: A set of tables


 The problem associated with trying to store all

the data in one table can be avoided by


creating a set of tables- one table for each
entity of interest.
 Redundancy is greatly reduced
 Avoids the insert anomaly and
 Avoids the deletion of information.
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
COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT x COURSE • The solution to the preceding problems is
SCID to use a set of tables in a relational
333333333-1234 database.
333333333-1236 • Each entity is stored in a separate table,
111111111-1235 and separate tables or foreign keys can be
111111111-1236 used to link the entities together.
Database Design Process
32
 There are six basic steps in database design:
 Planning Stage - involves the initial planning
to determine the need for and feasibility of
developing the new system.
 Requirements Analysis Stage - involves
identifying user information needs, defining
the planned new system scope, and
transaction volumes to make decisions about
hardware and software requirements.
 Design Stage - involves developing the
different schemas for the new system.
Cont’d……..
33

 Coding - involves translating the internal


level schema into the real or physical
database structures that will be
implemented in the new system.
 Implementation - involves transferring
data from existing systems to the new
database, testing the new system, and
training employees how to use it.
 Operation and Maintenance - involves
using and maintaining the system including
carefully monitoring system performance
Accountants should participate in all stages of the database design
process,
34

- In the planning stage, accountants both provide some of the information used to
evaluate the feasibility of the proposed project and participate in making that
decision.
- In the requirements analysis and design stages, accountants participate in
identifying user information needs, developing the logical schemas, designing the
data dictionary, and specifying controls.
- During the implementation stage, accountants can also help test the accuracy of
the new database and the application programs that will use that data.
- Finally, accountants use the database system to process transactions, and
sometimes they even help manage it.
Cont’d………..
35
 Data modeling is the process of defining a
database so that it faithfully represents all
aspects of the organization, including its
transactions.

Data Modeling in the database Design Process

Operation and
Planning
maintenance

Requirements
Data Implementation
modeling analysis
occurs
here
Design Coding
©2003 Prentice Hall Business Publishing, 5-13
Accounting Information Systems, 9/e, Romney/Steinbart
Cont’d………
36

 Data modeling occurs during both the


requirements analysis and design stages
of the database design process.
 The Two important tools of data modeling;
 Entity relationships diagramming and
 REA data model
Entity Relationship Diagrams
37

 An entity relationship (E-R) diagram is a


graphical technique for showing a database
schema.
 Shows the various entities being modeled

and relationships among them.


 Entities appear as rectangles and
relationships between entities are
represented as diamonds.
 E-R diagrams can be used to design
databases, document and understand
existing databases, and reengineer business
processes.
REA Data Model
38

 A conceptual modeling tool that focuses on the


business semantics underlying a value chain
activities.
 The REA model is an accounting framework for
modeling an organization’s critical resources,
events, and agents and the relationships
between them.
 REA model classifies entities into three
categories:
 Resources - the organization acquires to use,
 Events (business activities) - which the
organization engages on, and
Cont’d……..
39

 The events in REA data model fall into one of


the two categories:
 Economic exchanges or
 Commitments
 Economic exchanges - value chain activities
that directly affect the resources.
 E.g. Sales event decreases the inventory

and the cash receipts event increases the


amount of cash.
 Commitments - promises to engage in future
economic exchanges.
 E.g. Customer orders are commitments that
Cont’d………
40

 Events such as the sale of merchandise that change the


quantity of a resource are linked to that resource in what is
called a stock flow relationship.
 Other events such as taking a customer order that represent
future commitments are linked to resources called reserve
relationships.
 Each event is linked to two agent entities.
 Internal agent is the employee who is responsible for the

resource affected by the event.


 External agent is the outside party to the transaction.
 Each economic exchange event is linked in a give to get
duality relationship with another economic exchange event.
Cont’d……….
Basic REA template
41

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

©2003 Prentice Hall Business Publishing, 5-21


Cont’d……….
42

 Developing REA diagram for a specific


transaction cycle consists of four steps:
 Identify the pair of economic exchange

events
 Identify the resources affected by each event

and the agents who participate.


 Analyze each economic exchange event

 Determine the cardinalities of each


relationship.
Step 1: Identify Economic Exchange Events
 The basic REA template consists of a pair of
Cont’d……..
43

 The events are drawn as rectangles and the


economic duality relationship between them
as a diamond.
 In drawing REA model, the paper is divided
into three columns-one for each type of entity:
 The left column is used for resources,

 The center column for events, and

 The right column for agents.


 The event entities are drawn from top to
bottom corresponding to the sequence in
which they occur.
Cont’d……….
44

Step 2: Identify Resources and Agents


 Resources affected by the events need to

be identified
 The sales event is translated to giving

inventory to customers and the cash


receipts event is translated to receiving
cash from customers.
 Hence, the inventory and cash entities are
added in the resource column.
 A/R is not modeled as a separate entity

because it is not an independent object but


Cont’d……..
45

 Identify the agents who participate in


the events.
 There will always be at least one internal

agent (employee) and external agent


(customer or vendor) who participate in
each event.
 For example,
 Customers and salespersons
participate in the sale event, and
 Customers and cashiers participate in
the cash collection event.
Sample REA diagram
46

Inventory Stock-flow Sales Participant Salesperson

Participant

Economic
Customer
Duality

Participant

Cash
Cash Stock-flow Participant Cashier
Receipts

©2003 Prentice Hall Business Publishing, 5-22


Accounting Information Systems, 9/e, Romney/Steinbart
Step 3: Include Commitment Events

47

 It is important for management to get up to date information


about various orders to reorder various inventory items.
 It is also important to know which orders have been shipped
and when
 Example; the economic exchange event labeled sales may
be replaced with a combination of a commitment event
labeled customer orders.
Cont’d………
48

Step 4: Determine the Cardinalities of


Relationships
 The nature of relationships b/n the various

entities.
 Indicate how many instances of one entity can

be linked to one specific instance of another


entity.
 For example, how many sales transactions

can be linked to each individual customer


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

Cont’d……….
49

 It indicates whether a row in the table must


be linked to at least one row in the table on
the opposite side of that relationship.
 A minimum cardinality of 0 means that a new
row can be added to that table without being
linked to any specific rows in the table on the
other side of the relationship.
 The second number in each cardinality pair is
the maximum cardinality.
 It indicates whether one row in a table can be
linked to more than one row in the other
table.
Cont’d………
50
A maximum cardinality of 1 means
that each row in that table can be
linked to at most only one row in
another table.
Documentation of
Business Practices

 The zero minimum for the sales event indicates


that credit sales are made
 The N maximum for the sales event means that
customers may make installment payments

Cash Sales-
Cash Receipts Sales
Receipts (1, N) (0, N)

©2003 Prentice Hall Business Publishing, 5-56


Accounting Information Systems, 9/e, Romney/Steinbart
REA diagram for a sample revenue cycle
51

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

©2003 Prentice Hall Business Publishing, 5-28


Accounting Information Systems, 9/e, Romney/Steinbart
Cont’d………
52
 Three basic types of relationships
between entities are possible depending
on the maximum cardinality.
 A one to one (1:1) relationship exists

when the maximum cardinality for each


entity in that relationship is one.
 A one to many (1:N) relationship

exists when the maximum cardinality of


one entity in that relationship is 1 and
the maximum cardinality of the other
entity in that relationship is N
 Many to many (M:N) relationship
Cont’d…………
53

Rules for Specifying Cardinalities


 Cardinalities don’t select arbitrarily.
 Cardinalities reflect facts about the
organization being modeled and its business
practices.
Cardinality Rules for Agent-Event
Relationship
 The minimum and maximum cardinalities
associated with the event entity in every agent-
event relationship will be both 1.
 The minimum cardinality is 1 because there

must be an agent who participates in that


Cont’d………
54

 The cardinalities associated with each


agent entity in the agent-event
relationship all have zero minimums and
N maximums.
 The maximum cardinality associated

with internal agent entities is almost


always N, because organizations expect
their employees will participate in
numerous events.
 It is also usually N for external agents,

because organizations often engage in


repeat transactions with the same
Cont’d……….
55
 why the minimum cardinality associated
with agent entities in the agent-event
relationship is usually zero:
 Organizations want to be able to add

information about potential customers


and suppliers even though those agents
may not have participated yet in the
business transactions
Cont’d……….
56

Cardinality Rules for Resource-Event


Relationships
 The minimum and maximum cardinalities

associated with each resource in


resource-event relationship are zero and
N, respectively.
 The minimum cardinality associated with

event entities in resource-event


relationship is usually 1.
 For example, each sale event must

include at least one row in the inventory


Cont’d………
57

Cardinality Rules for Event-Event


Relationships
 Any kind of cardinality pair is possible for

each event entity in event-event


relationships.
 The organization's business practices and

policies must be understood to decide


which possibility is correct.
 For example, collections from customers

may be at once (1:1) or in installments


(1: N).
Cont’d………
58

 Implementing an REA diagram in a


relational database is a three-step
process:
 Create a table for each distinct entity

and for each many to many


relationships
 Assign attributes to appropriate tables
 Use foreign keys to implement one to

one and one to many relationships.


59

Questions?

Thank you!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy