Acct 316 Acct 316 Acct 316 Relational Databases 4 UAA – ACCT 316 Accounting Information Systems...

Post on 27-Dec-2015

278 views 6 download

Tags:

Transcript of Acct 316 Acct 316 Acct 316 Relational Databases 4 UAA – ACCT 316 Accounting Information Systems...

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

Relational Databases4

UAA – ACCT 316Accounting Information

SystemsDr. Fred Barbee

Ch

ap

ter

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

Creating a database can be like creating a universe, only more complicated. At least when the universe was created, there was no one around to complain.

Michael J. Hernandez Database Design for Mere Mortals

Addison Wesley, Boston, 1997

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

An Out-of-the-Text Experience!

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

Types of Databases

4

Chap

ter

Acct 3

16 A

cct 3

16 A

cct 3

16

Types of Databases

Operational Database

Used whenever there is a need to collect, maintain, and modify data.

Stores dynamic data (i.e., the data changes constantly and reflects up-to-the-minute information).

Acct 3

16 A

cct 3

16 A

cct 3

16

Types of Databases

Analytical Database

Used to store and track historical and time-dependent data..

Stores static data that is never (or rarely) modified. Information is applicable to a specific point in time.

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

Early Database Models

4

Chap

ter

Acct 3

16 A

cct 3

16 A

cct 3

16

Hierarchical Database Model

Data is structured hierarchically.

Visualize as an inverted tree.

A single table acts as the “root” of the tree.

Other tables act as branches flowing from the root.

Hierarchical Database Model

Hierarchical Database Model

AgentsAgents

EntertainersEntertainers ClientsClients

ScheduleSchedule PaymentsPaymentsEngagementsEngagements

Acct 3

16 A

cct 3

16 A

cct 3

16

Network Database Model

Visualize as an inverted tree.

Several inverted trees may share branches,

All of which are part of the same database structure.

The Network Database ModelThe Network Database Model

AgentsAgents

ClientsClients EntertainersEntertainers

PaymentsPayments Musical Styles

Musical StylesEngagementsEngagements

Represent Manage

Schedule Perform PlayMake

A Basic Set StructureA Basic Set Structure

Rela

tion

sh

ip

Owner Table

Member Table

AgentsAgents

ClientsClients

Set Structure

Rep

resen

t

Acct 3

16 A

cct 3

16 A

cct 3

16

Enter . . . The Relational Database Model

Relational Database

Rela

tional D

ata

base

s

Rela

tional D

ata

bases

Acct 3

16 A

cct 3

16 A

cct 3

16

Relational Database Model

Data is stored in relations, which are perceived by the user as tables.

Each relation is composed of tuples (records) and attributes (fields).

Fundamental Data Storage Concepts and Definitions

Accounts Receivable File

2 Entities 2 Records

Attributes

Customer Customer Credit number name Address limit Balance

Data values

301 ABC Co. Box 5 1,000 400 555 XYZ Co. Box 96,000 2,000

Individual fields

Acct 3

16 A

cct 3

16 A

cct 3

16

Relational Database Model

The physical order of the records of fields in a table is completely immaterial.

Each record in the table is identified by a field that contains a unique value.

A Relational Database ModelA Relational Database Model

AgentsAgents

ClientsClients EntertainersEntertainersMusical Styles

Musical Styles

Entertainer Styles

Entertainer StylesEngagementsEngagements

Agent ID First Name Last Name Hire Date Phone

100 Mike Hernandez 05/16/02 333-4444

101 Greg Piercy 10/15/02 444-3333

Client ID Agent ID First Name Last Name …..

9001 100 Stewart Jamison …..

9002 101 Shannon McClain …..

Agents

Clients

Ent ID Agent ID First Name Last Name …..

3000 100 John Slade …..

3001 101 Mark Weiser …..

Client ID Ent ID Eng. Date Time …..

9001 3001 04/01/02 1-3 PM …..

9002 3002 04/12/02 7-9 PM …..

Entertainers

Engagements

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

Now, Back to the Text

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

Double-Entry Vs. Database Accounting

Acct 3

16 A

cct 3

16 A

cct 3

16

Double-Entry Versus Database Accounting

Luca Pacioli and double-entry accounting.

Captures and stores key attributes of transactions in a highly aggregated form.

Acct 3

16 A

cct 3

16 A

cct 3

16

Double-Entry Versus Database Accounting

The beloved debit/credit convention provided an important internal control feature in manual systems.

Enter computerized accounting.

Acct 3

16 A

cct 3

16 A

cct 3

16

Double-Entry Versus Database Accounting

The ability to quickly capture lots of data quickly . . .

Date and time of purchase

Identity of item purchased

Store location

Checkout station number

Cashier number

Acct 3

16 A

cct 3

16 A

cct 3

16

Double-Entry Versus Database Accounting

Consider a simple transaction:

On November 18, 2002 we made a sale to Jones Enterprises for $10,000 on credit.

Terms 2/10, n/30

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

How would we handle this transaction in a double-entry system?

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

Files Vs. Databases

4

Chap

ter

Fundamental Data Storage Concepts and Definitions

Accounts Receivable File

2 Entities 2 Records

Attributes

Customer Customer Credit number name Address limit Balance

Data values

301 ABC Co. Box 5 1,000 400 555 XYZ Co. Box 96,000 2,000

Individual fields

Acct 3

16 A

cct 3

16 A

cct 3

16

Basic File Types

The master file, which is conceptually similar to a ledger in a manual system.

The transaction file, which is conceptually similar to a journal in a manual system.

File-Oriented Approach

Applicationprogram #1

File # 1

Item A Item B Item C

Applicationprogram #2

File # 2

Item B Item D Item E

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

How would we handle this transaction in a relational database system.

Acct 3

16 A

cct 3

16 A

cct 3

16

Databases

The database approach views data as an organizational resource that should be . . .

used by, and

managed for,

the entire organization

Acct 3

16 A

cct 3

16 A

cct 3

16

Databases

A database is a set of interrelated, centrally coordinated files.

Focus is on

Data integration

Data sharing

Database Approach

Applicationprogram #3

Applicationprogram #2

Databasemanagement

system

Applicationprogram #1

Item A Item B Item C Item D Item E

Database

Database System

Applicationprogram #3

Applicationprogram #2

Databasemanagement

system

Applicationprogram #1

Item A Item B Item C Item D Item E

Database

DBMS refers to programs that control the data and interfaces between the

data and the application programs.

The Data Base Administrator (DBA) is

responsible for the database.

A Database Accounting System

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

Advantages & Disadvantages of Relational Database Systems

Acct 3

16 A

cct 3

16 A

cct 3

16

Advantages

Reduce data storage costs

Eliminate data redundancy

Eliminate data inconsistencies

Avoid duplicate processing

Acct 3

16 A

cct 3

16 A

cct 3

16

Advantages

Ease add, delete, and update data maintenance tasks

Make data independent of applications

Centralize data management

Centralize data security

Acct 3

16 A

cct 3

16 A

cct 3

16

Advantages

Ease report modifications and updats

Provide ad hoc query capabilities

Facilitate cross-functional data analysis

Acct 3

16 A

cct 3

16 A

cct 3

16

Advantages

Permit multiple users simultaneous data access.

Acct 3

16 A

cct 3

16 A

cct 3

16

Disadvantages

Greater hardware requirements

The database software itself

Employing a database administrator.

Acct 3

16 A

cct 3

16 A

cct 3

16

Disadvantages

Centralization of data . . .

System operation becomes critical

Incorrect data entry corrupts many users’ work

Territorial disputes over data ownership may arise

Acct 3

16 A

cct 3

16 A

cct 3

16

One Last Disadvantage

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

It’s Your Turn!

Discussion Question 4.3 p. 99

The text explained how database technology may eliminate the need for double-entry accounting. This creates three possibilities:

The double-entry model will be abandoned,

The double-entry model will not be used directly, but an external-level schema based on the double-entry model will be defined for accountant’s use; or

The double entry model will be retained in database systems.

Which alternative do you think is most likely to occur? Why?

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

Logical View

Vs.Physical

View

Acct 3

16 A

cct 3

16 A

cct 3

16

Physical View

Acct 3

16 A

cct 3

16 A

cct 3

16

Physical View

The physical view refers to how and where the data are physically arranged and stored on disk, tape, CD-ROM, or other media.

Acct 3

16 A

cct 3

16 A

cct 3

16

Logical View

The logical view is how the user or programmer conceptually organizes and understands the data.

Logical View Vs. Physical View

Credit Report

Customer NumberCredit Limit

Balance

Monthly Statement

Customer NameAddressBalance

Customer NumberCustomer Name

AddressCredit Limit

Balance

How data are stored

on disk.

Logical View Data Physical View

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

Schemas

4

Chap

ter

Acct 3

16 A

cct 3

16 A

cct 3

16

Schemas

A schema describes the logical structure of a database.There are three levels:

Conceptual-LevelExternal-LevelInternal-level

Conceptual-Level Schema

An organization-wide view of the entire database.

External-Level Schema

Consists of a set of individual user views of portions of the database, also referred to as a subschema.

Internal-Level Schema

The internal-level schema provides a low-level view of the database.

Database Management System

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

DBMS Languages

4

Chap

ter

Acct 3

16 A

cct 3

16 A

cct 3

16

DBMS Languages

Every DBMS must provide a means of performing the three basic functions:

Creating the database

Changing the database

Querying the database

Acct 3

16 A

cct 3

16 A

cct 3

16

Data Definition Language (DDL)

Build the data dictionary.

Initialize or create the database.

Describe the logical views for each individual user or programmer.

Specify any limitations or constraints on security imposed on database record or fields.

Acct 3

16 A

cct 3

16 A

cct 3

16

Data Manipulation Language (DML)

Used for data maintenance.

updating portions of the database

inserting portions of the database

deleting portions of the database

Acct 3

16 A

cct 3

16 A

cct 3

16

Data Query Language (DQL)

The data query language (DQL) is used to interrogate the database.

The DQL retrieves, sorts, orders, and presents subsets of the database in response to user queries.

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

More on the Relational Data Model

4

Ch

ap

ter

Table in a Relational Data Model

Acct 3

16 A

cct 3

16 A

cct 3

16

Basic Requirements of the Relational Data Model

Primary keys must be unique.

The primary key cannot be null (blank).

Why?

Known as the entity integrity rule.

Acct 3

16 A

cct 3

16 A

cct 3

16

What is the entity integrity rule?

The entity integrity rule ensures that every row in every relation (table) must represent data about some specific object in the real world.

Acct 3

16 A

cct 3

16 A

cct 3

16

Basic Requirements of the Relational Data Model

Every foreign key must either be null or have a value corresponding to the value of a primary key in another relation.

Why?

The referential integrity rule.

Acct 3

16 A

cct 3

16 A

cct 3

16

What is the referential integrity rule?

The referential integrity rule ensures that links exist among the tables of a database.

Basic Relational Data Model Stuff

Relation = Table = File

Some terminology

Table in a Relational Data Model

Tuple = Row = Record

Some terminology

Table in a Relational Data Model

Attribute = Column = Field

Some terminology

Attribute = Column = Field

Each column in a table must describe a characteristic of the object identified by the primary key.

Attribute = Column = Field

Each attribute (column) in a table has a distinct name, called the attribute name.

Attribute = Column = Field

Every entry in a column contains a value for that column only, and the values are of the same data type.

Attribute = Column = Field

The order (position) of the columns in relation to each other is unimportant.

Tuple = Row = Record

The entries in each column of any row must be single valued.

Tuple = Row = Record

The order of the rows is unimportant.

Tuple = Row = Record

Each row is unique; it differs from all other rows in the table.

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

How does a database

differ from a spreadsheet

?

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

How might an accountant’s

familiarity with the tabular

representation of spreadsheets

facilitate or hinder learning how to use a relational DBMS?

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

Importance of a Well-Structured Relational Database

4

Ch

ap

ter

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

Anomalies that may occur in non-normalized relational tables.

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

Normalization! Anomalies! WOW! You accountants are an odd lot!

What is normalization? Is anything normal

around here?

Acct 3

16 A

cct 3

16 A

cct 3

16

Normalization

A technique used to make complex databases more efficient by removing undesirable redundancy.

Break one large table into several smaller tables.

Normalization

Normalization starts with the assumption that everything is initially stored in one large table.

A set of rules is then followed to decompose that initial table into a set of normalized tables.

The objective is to produce a set of tables that are in what is called third normal form (3NF)

Acct 3

16 A

cct 3

16 A

cct 3

16

Normalization

Problems caused by redundancy:

Storage inefficiencies

Processing inefficiencies

Errors

Acct 3

16 A

cct 3

16 A

cct 3

16

Update Anomaly

When changes (updates) to data values are not correctly recorded.

Acct 3

16 A

cct 3

16 A

cct 3

16

Insert Anomaly

There is no way to store information about one entity in the database without it being associated with another entity

Acct 3

16 A

cct 3

16 A

cct 3

16

Delete Anomaly

Unintended results arising from deleting a row of data pertaining to one entity and resulting in the deletion of data regarding another entity as well.

Acct 316 Acct 316 Acct 316 Acct 316 Acct 316 Acct 316

Acct 3

16 A

cct 3

16 A

cct 3

16

Database Design

4

Ch

ap

ter

Acct 3

16 A

cct 3

16 A

cct 3

16

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.

Acct 3

16 A

cct 3

16 A

cct 3

16

Approaches to Database Design

Semantic Data Modeling

The database designer uses his/her knowledge about the business structure to create a set of relational tables.

Acct 3

16 A

cct 3

16 A

cct 3

16

Database Design Objectives

Completeness

Relevance

Accessibility

Up-to-dateness flexibility

Acct 3

16 A

cct 3

16 A

cct 3

16

Database Design Objectives

Efficiency

Cost-effectiveness

Integrity

Security

Acct 3

16 A

cct 3

16 A

cct 3

16

Database Systems and theFuture of Accounting

Database systems have the potential to significantly alter the nature of external reporting.

Acct 3

16 A

cct 3

16 A

cct 3

16

Database Systems and theFuture of Accounting

Perhaps the most significant effect of database systems will be in the way that accounting information is used in decision making.