SlideShare a Scribd company logo
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 1 of 96
C HAPTER 4
Relational Databases
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 2 of 96
INTRODUCTION
• Relational databases underlie 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.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 3 of 96
File Vs. Databases
• Database systems were developed to address the problems
associated with the proliferation of master files.
– For years, each time a new information need arose,
companies created new files and programs.
– The result: a significant increase in the number of
master files.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 4 of 96
FILE VS. DATABASES
• This proliferation of master files created
problems:
– Often the same information was stored in
multiple master files.
– Made it more difficult to effectively integrate
data and obtain an organization-wide view of
the data.
– Also, the same information may not have been
consistent between files.
• If a student changed his phone number, it
may have been updated in one master file
but not another.
Master File 1
Fact A
Fact B
Fact C
Master File 2
Fact A
Fact D
Fact F
Master File 1
Fact A
Fact B
Fact F
Enrollment
Program
Financial Aid
Program
Grades
Program
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 5 of 96
FILE VS. DATABASES
• A database is a set of inter-
related, centrally coordinated
files.
Database
Fact A Fact B
Fact C Fact D
Fact E Fact F
Enrollment
Program
Financial Aid
Program
Grades
Program
Database
Management
System
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 6 of 96
FILE VS. DATABASES
• The database approach treats data
as an organizational resource that
should be used by and managed
for the entire organization, not
just a particular department.
• A database management system
(DBMS) serves as the interface
between the database and the
various application programs.
Database
Fact A Fact B
Fact C Fact D
Fact E Fact F
Enrollment
Program
Financial Aid
Program
Grades
Program
Database
Management
System
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 7 of 96
FILE VS. DATABASES
• The combination of the sdatabase,
the DBMS, and the application
program that access the database
is referred to as the database
system.
Database
Fact A Fact B
Fact C Fact D
Fact E Fact F
Enrollment
Program
Financial Aid
Program
Grades
Program
Database
Management
System
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 8 of 96
FILE VS. DATABASES
• The person responsible for the database is
the Database Administrator.
• As technology improves, many large
companies are developing very large
databases called Data Warehouses.
Database
Fact A Fact B
Fact C Fact D
Fact E Fact F
Enrollment
Program
Financial Aid
Program
Grades
Program
Database
Management
System
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 9 of 96
Importance And Advantages Of Database Systems
• As accountants, you are likely to audit or work for companies that use
database technology to store, process, and report accounting
transactions.
– Many accountants work directly with databases and will enter,
process, and query databases.
– Some will develop and evaluate internal controls necessary to
ensure database integrity.
– Others will be involved in the design and management of
databases.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 10 of 96
IMPORTANCE AND ADVANTAGES OF
DATABASE SYSTEMS
• Database technology provides the following benefits to
organizations:
– Data integration
• Achieved by combining master files into larger
pools of data accessible by many programs.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 11 of 96
IMPORTANCE AND ADVANTAGES OF DATABASE SYSTEMS
• Database technology provides the following benefits to
organizations:
– Data integration
– Data sharing
• It’s easier to share data that’s integrated—the FBI is planning an 8
year, $400 million database project to make data more available to
agency users.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 12 of 96
Importance And Advantages Of Database Systems
• Database technology provides the following benefits to
organizations:
– Data integration
– Data sharing
– Reporting flexibility
• Reports can be revised easily and generated as needed.
• The database can easily be browsed to research
problems or obtain detailed information.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 13 of 96
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
• Because data items are usually stored only once.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 14 of 96
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
• Data items are independent of the programs that use them.
• Consequently, a data item can be changed without changing the program
and vice versa.
• Makes programming easier and simplifies data management.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 15 of 96
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
• Data management is more efficient
because the database administrator is
responsible for coordinating, controlling,
and managing data.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 16 of 96
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
• Relationships can be explicitly defined and used in
the preparation of management reports.
• Example: relationship between selling costs and
promotional campaign's.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 17 of 96
Database Systems
• Logical and physical views of data
– In file-oriented systems, programmers must know the physical
location and layout of records used by a program.
• They must reference the location, length, and format of every
field they utilize.
• When data is used from several files, this process becomes
more complex.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 18 of 96
Database Systems
• Database systems overcome this problem by separating the
storage and use of data elements.
– Two separate views of the data are provided:
• Logical view
 How the user or programmer conceptually organizes
and understands the data.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 19 of 96
Database Systems
• Database systems overcome this problem by
separating the storage and use of data elements.
– Two separate views of the data are provided:
• Logical view
• Physical view
 How and where the data are physically arranged and
stored.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 20 of 96
DATABASE SYSTEMS
• Database systems overcome this problem by separating the storage and use
of data elements.
– Two separate views of the data are provided:
• Logical view
• Physical view
– Separating these views facilitates application development, because
programmers can focus on coding the logic and not be concerned
with storage details.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 21 of 96
Database
Logical View—User A Logical View—User B
DBMS
Operating
System
The DBMS translates users’ logical
views into instructions as to which
data should be retrieved from the
database.
Enrollment by Class
Scholarship Distribution
Fr.
5%
Soph.
24%
Jr.
38%
Sr.
33%
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 22 of 96
Database
Enrollment by Class
Logical View—User A Logical View—User B
DBMS
Operating
System
The operating system translates
DBMS requests into instructions to
physically retrieve data from
various disks.
Scholarship Distribution
Fr.
5%
Soph.
24%
Jr.
38%
Sr.
33%
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 23 of 96
Database Systems
• The DBMS handles the link between the physical and
logical views of the data.
– Allows the user to access, query, and update data
without reference to how or where it is physically stored.
– The user only needs to define the logical data
requirements.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 24 of 96
Database Systems
• Schemas
– A schema describes the logical structure of a database.
– There are three levels of schema.
• Conceptual level
• The organization-wide view of the entire database i.e. the big
picture.
• Lists all data elements and the relationships between them.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 25 of 96
Subschema--User A Subschema--User B Subschema--User C
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
Enroll
Cash
Receipt
Classes Student
Mapping external-level views to conceptual-level schema
Mapping conceptual-level items to internal-level descriptions
Smith . . . A
Jones . . . B
Arnold . . .D
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 26 of 96
DATABASE SYSTEMS
• Schemas
– A schema describes the logical structure of a database.
– There are three levels of schema.
• Conceptual level
• External level
• A set of individual user views of portions of the database, i.e., how each user
sees the portion of the system with which he interacts.
• These individual views are referred to as subschema.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 27 of 96
Subschema--User A Subschema--User B Subschema--User C
Enroll
Cash
Receipt
Classes Student
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
Mapping external-level views to conceptual-level schema
Mapping conceptual-level items to internal-level descriptions
Smith . . . A
Jones . . . B
Arnold . . .D
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 28 of 96
DATABASE SYSTEMS
• Schemas
– A schema describes the logical structure of a database.
– There are three levels of schema.
• Conceptual level
• External level
• Internal level
• A low-level view of the database.
• It describes how the data are actually
stored and accessed including:
– Record layouts
– Definitions
– Addresses
– Indexes
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 29 of 96
Subschema--User A Subschema--User B Subschema--User C
Enroll
Cash
Receipt
Classes Student
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
Mapping external-level views to conceptual-level schema
Mapping conceptual-level items to internal-level descriptions
Smith . . . A
Jones . . . B
Arnold . . .D
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 30 of 96
Database Systems
• Accountants are frequently involved in developing
conceptual- and external-level schema.
• An employee’s access to data should be limited to
the subschema of data that is relevant to the
performance of his job.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 31 of 96
Database Systems
• The data dictionary
– A key component of a DBMS is the data dictionary.
• Contains information about the structure of the
database.
• For each data element, there is a corresponding
record in the data dictionary describing that element.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 32 of 96
Database Systems
• Information provided for each element includes:
– A description or explanation of the element.
– The records in which it is contained.
– Its source.
– The length and type of the field in which it is stored.
– The programs in which it is used.
– The outputs in which it is contained.
– The authorized users of the element.
– Other names for the element.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 33 of 96
DATABASE SYSTEMS
 Accountants should participate in the
development of the data dictionary because they
have a good understanding of the data elements
in a business organization, as well as where
those elements originate and how they are used.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 34 of 96
DATABASE SYSTEMS
• DBMS Languages
–Every DBMS must provide a means of
performing the three basic functions of:
• Creating a database
• Changing a database
• Querying a database
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 35 of 96
DATABASE SYSTEMS
• Creating a database:
– The set of commands used to create the
database is known as data definition
language (DDL). DDL is used to:
• 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 records or fields
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 36 of 96
DATABASE SYSTEMS
• Changing a database
– The set of commands used to change the
database is known as data manipulation
language (DML). DML is used for
maintaining the data including:
• Updating data
• Inserting data
• Deleting portions of the database
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 37 of 96
DATABASE SYSTEMS
• Querying a database:
– The set of commands used to query the database is
known as data query language (DQL). DQL is used
to interrogate the database, including:
• Retrieving records
• Sorting records
• Ordering records
• Presenting subsets of the database
– The DQL usually contains easy-to-use, powerful
commands that enable users to satisfy their own
information needs.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 38 of 96
DATABASE SYSTEMS
• Report Writer
– Many DBMS packages also include a report writer, a
language that simplifies the creation of reports.
– Users typically specify:
• What elements they want printed
• How the report should be formatted
– The report writer then:
• Searches the database
• Extracts specified data
• Prints them out according to specified format
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 39 of 96
RELATIONAL DATABASES
• A DBMS is characterized by the type of
logical data model on which it is based.
– A data model is an abstract representation of
the contents of a database.
– Most new DBMSs are called relational
databases because they use the relational
model developed by E. F. Codd in 1970.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 40 of 96
RELATIONAL DATABASES
• The relational data model represents
everything in the database as being stored
in the forms of tables (aka, relations).
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 41 of 96
Student ID
Last
Name
First
Name
Phone
No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555
STUDENTS
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
COURSES
Relation
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
STUDENT x COURSE
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 42 of 96
RELATIONAL DATABASES
• This model only describes how the data
appear in the conceptual- and external-
level schemas.
• The data are physically stored according
to the description in the internal-level
schema.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 43 of 96
Student ID
Last
Name
First
Name
Phone
No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555
STUDENTS
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
COURSES
A primary key is the
attribute or combination
of attributes that
uniquely identifies a
specific row in a table.
STUDENT x COURSE
SCID
333333333-1234
333333333-1236
111111111-1235
111111111-1236
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 44 of 96
STUDENT x COURSE
SCID
333333333-1234
333333333-1236
111111111-1235
111111111-1236
Student ID
Last
Name
First
Name
Phone
No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555
STUDENTS
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
COURSES
In some tables, two or more attributes
may be joined to form the primary key.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 45 of 96
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
STUDENTS
Student ID Last Name
First Nam
e Phone No.
Advisor N
o.
333-33-3333 Simpson Alice 333-3333 1418
111-11-1111 Sanders Ned 444-4444 1418
123-45-6789 Moore Artie 555-5555 1503
A foreign key is an attribute in one table that is a primary key in
another table.
Foreign keys are used to link tables together.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 46 of 96
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.
STUDENTS
Student ID Last Name
First Nam
e Phone No.
Advisor N
o.
333-33-3333 Simpson Alice 333-3333 1418
111-11-1111 Sanders Ned 444-4444 1418
123-45-6789 Moore Artie 555-5555 1503
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 47 of 96
RELATIONAL DATABASES
• Alternatives for storing data
– One possible alternate approach would be to
store all data in one uniform table.
– For example, instead of separate tables for
students and classes, we could store all data
in one table and have a separate line for each
student x class combination.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 48 of 96
Student ID
Last Nam
e
First
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.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 49 of 96
Student ID
Last Nam
e
First
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
• Suppose Alice Simpson changes her phone number. You need to
make the change in three places. If you fail to change it in all three
places or change it incorrectly in one place, then the records for
Alice will be inconsistent.
• This problem is referred to as an update anomaly.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 50 of 96
Student ID
Last Nam
e
First
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
• What happens if you have a new student to add, but he hasn’t
signed up for any courses yet?
• Or what if there is a new class to add, but there are no students
enrolled in it yet? In either case, the record will be partially blank.
• This problem is referred to as an insert anomaly.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 51 of 96
Student ID
Last Nam
e
First
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
• If Ned withdraws from all his classes and you eliminate all three of
his rows from the table, then you will no longer have a record of
Ned. If Ned is planning to take classes next semester, then you
probably didn’t really want to delete all records of him.
• This problem is referred to as a delete anomaly.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 52 of 96
STUDENT x COURSE
SCID
333333333-1234
333333333-1236
111111111-1235
111111111-1236
Student ID
Last
Name
First
Name
Phone
No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555
STUDENTS
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
COURSES
• The solution to the preceding problems
is to use a set of tables in a relational
database.
• Each entity is stored in a separate table,
and separate tables or foreign keys can
be used to link the entities together.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 53 of 96
RELATIONAL DATABASES
• Basic requirements of a relational database
– Every column in a row must be single valued.
• In other words, every cell can have one and only
one value.
• In the student table, you couldn’t have an attribute
named “Phone Number” if a student could have
multiple phone numbers.
• There might be an attribute named “local phone
number” and an attribute named “permanent
phone number.”
• You could not have an attribute named “Class” in
the student table, because a student could take
multiple classes.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 54 of 96
RELATIONAL DATABASES
• Basic requirements of a relational
database
– The primary key cannot be null.
• The primary key uniquely identifies a specific row
in the table, so it cannot be null, and it must be
unique for every record.
• This rule is referred to as the entity integrity rule.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 55 of 96
STUDENT x COURSE
SCID
333333333-1234
333333333-1236
111111111-1235
111111111-1236
Student ID
Last
Name
First
Name
Phone
No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555
STUDENTS
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
COURSES
• Note that within each table, there are no
duplicate primary keys and no null
primary keys.
• Consistent with the entity integrity rule.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 56 of 96
RELATIONAL DATABASES
• Basic requirements of a relational
database
– A foreign key must either be null or
correspond to the value of a primary key in
another table.
• This rule is referred to as the referential integrity
rule.
• The rule is necessary because foreign keys are
used to link rows in one table to rows in another
table.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 57 of 96
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
STUDENTS
Student ID Last Name
First Nam
e Phone No.
Advisor N
o.
333-33-3333 Simpson Alice 333-3333 1418
111-11-1111 Sanders Ned 444-4444 1418
123-45-6789 Moore Artie 555-5555 1503
Advisor No. is a foreign key in the STUDENTS table. Every
incident of Advisor No. in the STUDENTS table either matches
an instance of the primary key in the ADVISORS table or is null.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 58 of 96
RELATIONAL DATABASES
• Basic requirements of a relational
database
– All non-key attributes in a table should
describe a characteristic of the object
identified by the primary key.
• Could nationality be a non-key attribute in the
student table?
• Could advisor’s nationality be a non-key attribute
in the student table?
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 59 of 96
RELATIONAL DATABASES
• There are two basic ways to design well-
structured relational databases.
– Normalization
– Semantic data modeling
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 60 of 96
RELATIONAL DATABASES
• Normalization
– Starts with the assumption that everything is
initially stored in one large table.
– A set of rules is followed to decompose that
initial table into a set of normalized tables.
– Objective is to produce a set of tables in third-
normal form (3NF) because such tables are
free of update, insert, and delete anomalies.
– Approach is beyond the scope of this book
but can be found in any database textbook.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 61 of 96
RELATIONAL DATABASES
• There are two basic ways to design well-
structured relational databases.
– Normalization
– Semantic data modeling
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 62 of 96
RELATIONAL DATABASES
• Semantic data modeling (covered in REA
datamodel)
– Database designer uses knowledge about
how business processes typically work and
the information needs associated with
transaction processing to draw a graphical
picture of what should be included in the
database.
– The resulting graphic is used to create a set
of relational tables that are in 3NF.
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 63 of 96
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.

More Related Content

PPT
Database System
PPT
Ais Romney 2006 Slides 04 Relational Databases
PPT
Ais Romney 2006 Slides 04 Relational Databases
PPT
Ais Romney 2006 Slides 04 Relational Databases
PPTX
Chapter 4 Chapter Relational DB - Copy.pptx
PPTX
LEARNING OBJECTIVES education relational.pptx
PPT
Database Enviornment
PPTX
CHAPTER-4_RELATIONAL-DATABASE.pptx
Database System
Ais Romney 2006 Slides 04 Relational Databases
Ais Romney 2006 Slides 04 Relational Databases
Ais Romney 2006 Slides 04 Relational Databases
Chapter 4 Chapter Relational DB - Copy.pptx
LEARNING OBJECTIVES education relational.pptx
Database Enviornment
CHAPTER-4_RELATIONAL-DATABASE.pptx

Similar to ch04 relational db & REA datamodel Cost allocation for supporting departments and accounting for Joint product and Byproduct .ppt (20)

PPTX
PPTX
Pp 09-new
PDF
Accounting Information Systems The Crossroads of Accounting and IT 2nd Editio...
PPTX
Understanding the Value of Database Discovery - Beyond Unstructured Data
PPT
INTRODUCTION TO RDBMS
PPTX
DBMS Introduction: Database Users and Databases
PPT
IntroductionAccountingInformationSystems.ppt
PDF
Database Lecture One Introduction to databases
PPT
W 8 introduction to database
PDF
Accounting Information Systems The Crossroads of Accounting and IT 2nd Editio...
PPTX
Database Technology- ITM
PPTX
Database Technology- ITM
PPT
Information_Systems
PPTX
Introduction to Database and database users.pptx
PPT
Chapter01
PPT
Ena ch01
PPT
Ena ch01
PPT
Chapte sdfbjsvfjsb shdvgsfjsdhvshyjhscdgppt
PDF
Lecture1 is322 data&infomanag(introduction)(old curr)
PDF
Lecture1-IS322(Data&InfoMang-introduction)
Pp 09-new
Accounting Information Systems The Crossroads of Accounting and IT 2nd Editio...
Understanding the Value of Database Discovery - Beyond Unstructured Data
INTRODUCTION TO RDBMS
DBMS Introduction: Database Users and Databases
IntroductionAccountingInformationSystems.ppt
Database Lecture One Introduction to databases
W 8 introduction to database
Accounting Information Systems The Crossroads of Accounting and IT 2nd Editio...
Database Technology- ITM
Database Technology- ITM
Information_Systems
Introduction to Database and database users.pptx
Chapter01
Ena ch01
Ena ch01
Chapte sdfbjsvfjsb shdvgsfjsdhvshyjhscdgppt
Lecture1 is322 data&infomanag(introduction)(old curr)
Lecture1-IS322(Data&InfoMang-introduction)
Ad

Recently uploaded (20)

PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PPTX
Lesson notes of climatology university.
PDF
Empowerment Technology for Senior High School Guide
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
History, Philosophy and sociology of education (1).pptx
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
PDF
Trump Administration's workforce development strategy
PPTX
Digestion and Absorption of Carbohydrates, Proteina and Fats
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
Computing-Curriculum for Schools in Ghana
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
LDMMIA Reiki Yoga Finals Review Spring Summer
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Paper A Mock Exam 9_ Attempt review.pdf.
Lesson notes of climatology university.
Empowerment Technology for Senior High School Guide
Orientation - ARALprogram of Deped to the Parents.pptx
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
History, Philosophy and sociology of education (1).pptx
202450812 BayCHI UCSC-SV 20250812 v17.pptx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
Trump Administration's workforce development strategy
Digestion and Absorption of Carbohydrates, Proteina and Fats
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Ad

ch04 relational db & REA datamodel Cost allocation for supporting departments and accounting for Joint product and Byproduct .ppt

  • 1. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 1 of 96 C HAPTER 4 Relational Databases
  • 2. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 2 of 96 INTRODUCTION • Relational databases underlie 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.
  • 3. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 3 of 96 File Vs. Databases • Database systems were developed to address the problems associated with the proliferation of master files. – For years, each time a new information need arose, companies created new files and programs. – The result: a significant increase in the number of master files.
  • 4. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 4 of 96 FILE VS. DATABASES • This proliferation of master files created problems: – Often the same information was stored in multiple master files. – Made it more difficult to effectively integrate data and obtain an organization-wide view of the data. – Also, the same information may not have been consistent between files. • If a student changed his phone number, it may have been updated in one master file but not another. Master File 1 Fact A Fact B Fact C Master File 2 Fact A Fact D Fact F Master File 1 Fact A Fact B Fact F Enrollment Program Financial Aid Program Grades Program
  • 5. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 5 of 96 FILE VS. DATABASES • A database is a set of inter- related, centrally coordinated files. Database Fact A Fact B Fact C Fact D Fact E Fact F Enrollment Program Financial Aid Program Grades Program Database Management System
  • 6. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 6 of 96 FILE VS. DATABASES • The database approach treats data as an organizational resource that should be used by and managed for the entire organization, not just a particular department. • A database management system (DBMS) serves as the interface between the database and the various application programs. Database Fact A Fact B Fact C Fact D Fact E Fact F Enrollment Program Financial Aid Program Grades Program Database Management System
  • 7. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 7 of 96 FILE VS. DATABASES • The combination of the sdatabase, the DBMS, and the application program that access the database is referred to as the database system. Database Fact A Fact B Fact C Fact D Fact E Fact F Enrollment Program Financial Aid Program Grades Program Database Management System
  • 8. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 8 of 96 FILE VS. DATABASES • The person responsible for the database is the Database Administrator. • As technology improves, many large companies are developing very large databases called Data Warehouses. Database Fact A Fact B Fact C Fact D Fact E Fact F Enrollment Program Financial Aid Program Grades Program Database Management System
  • 9. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 9 of 96 Importance And Advantages Of Database Systems • As accountants, you are likely to audit or work for companies that use database technology to store, process, and report accounting transactions. – Many accountants work directly with databases and will enter, process, and query databases. – Some will develop and evaluate internal controls necessary to ensure database integrity. – Others will be involved in the design and management of databases.
  • 10. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 10 of 96 IMPORTANCE AND ADVANTAGES OF DATABASE SYSTEMS • Database technology provides the following benefits to organizations: – Data integration • Achieved by combining master files into larger pools of data accessible by many programs.
  • 11. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 11 of 96 IMPORTANCE AND ADVANTAGES OF DATABASE SYSTEMS • Database technology provides the following benefits to organizations: – Data integration – Data sharing • It’s easier to share data that’s integrated—the FBI is planning an 8 year, $400 million database project to make data more available to agency users.
  • 12. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 12 of 96 Importance And Advantages Of Database Systems • Database technology provides the following benefits to organizations: – Data integration – Data sharing – Reporting flexibility • Reports can be revised easily and generated as needed. • The database can easily be browsed to research problems or obtain detailed information.
  • 13. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 13 of 96 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 • Because data items are usually stored only once.
  • 14. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 14 of 96 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 • Data items are independent of the programs that use them. • Consequently, a data item can be changed without changing the program and vice versa. • Makes programming easier and simplifies data management.
  • 15. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 15 of 96 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 • Data management is more efficient because the database administrator is responsible for coordinating, controlling, and managing data.
  • 16. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 16 of 96 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 • Relationships can be explicitly defined and used in the preparation of management reports. • Example: relationship between selling costs and promotional campaign's.
  • 17. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 17 of 96 Database Systems • Logical and physical views of data – In file-oriented systems, programmers must know the physical location and layout of records used by a program. • They must reference the location, length, and format of every field they utilize. • When data is used from several files, this process becomes more complex.
  • 18. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 18 of 96 Database Systems • Database systems overcome this problem by separating the storage and use of data elements. – Two separate views of the data are provided: • Logical view  How the user or programmer conceptually organizes and understands the data.
  • 19. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 19 of 96 Database Systems • Database systems overcome this problem by separating the storage and use of data elements. – Two separate views of the data are provided: • Logical view • Physical view  How and where the data are physically arranged and stored.
  • 20. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 20 of 96 DATABASE SYSTEMS • Database systems overcome this problem by separating the storage and use of data elements. – Two separate views of the data are provided: • Logical view • Physical view – Separating these views facilitates application development, because programmers can focus on coding the logic and not be concerned with storage details.
  • 21. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 21 of 96 Database Logical View—User A Logical View—User B DBMS Operating System The DBMS translates users’ logical views into instructions as to which data should be retrieved from the database. Enrollment by Class Scholarship Distribution Fr. 5% Soph. 24% Jr. 38% Sr. 33%
  • 22. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 22 of 96 Database Enrollment by Class Logical View—User A Logical View—User B DBMS Operating System The operating system translates DBMS requests into instructions to physically retrieve data from various disks. Scholarship Distribution Fr. 5% Soph. 24% Jr. 38% Sr. 33%
  • 23. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 23 of 96 Database Systems • The DBMS handles the link between the physical and logical views of the data. – Allows the user to access, query, and update data without reference to how or where it is physically stored. – The user only needs to define the logical data requirements.
  • 24. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 24 of 96 Database Systems • Schemas – A schema describes the logical structure of a database. – There are three levels of schema. • Conceptual level • The organization-wide view of the entire database i.e. the big picture. • Lists all data elements and the relationships between them.
  • 25. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 25 of 96 Subschema--User A Subschema--User B Subschema--User C 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 Enroll Cash Receipt Classes Student Mapping external-level views to conceptual-level schema Mapping conceptual-level items to internal-level descriptions Smith . . . A Jones . . . B Arnold . . .D
  • 26. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 26 of 96 DATABASE SYSTEMS • Schemas – A schema describes the logical structure of a database. – There are three levels of schema. • Conceptual level • External level • A set of individual user views of portions of the database, i.e., how each user sees the portion of the system with which he interacts. • These individual views are referred to as subschema.
  • 27. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 27 of 96 Subschema--User A Subschema--User B Subschema--User C Enroll Cash Receipt Classes Student 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 Mapping external-level views to conceptual-level schema Mapping conceptual-level items to internal-level descriptions Smith . . . A Jones . . . B Arnold . . .D
  • 28. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 28 of 96 DATABASE SYSTEMS • Schemas – A schema describes the logical structure of a database. – There are three levels of schema. • Conceptual level • External level • Internal level • A low-level view of the database. • It describes how the data are actually stored and accessed including: – Record layouts – Definitions – Addresses – Indexes
  • 29. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 29 of 96 Subschema--User A Subschema--User B Subschema--User C Enroll Cash Receipt Classes Student 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 Mapping external-level views to conceptual-level schema Mapping conceptual-level items to internal-level descriptions Smith . . . A Jones . . . B Arnold . . .D
  • 30. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 30 of 96 Database Systems • Accountants are frequently involved in developing conceptual- and external-level schema. • An employee’s access to data should be limited to the subschema of data that is relevant to the performance of his job.
  • 31. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 31 of 96 Database Systems • The data dictionary – A key component of a DBMS is the data dictionary. • Contains information about the structure of the database. • For each data element, there is a corresponding record in the data dictionary describing that element.
  • 32. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 32 of 96 Database Systems • Information provided for each element includes: – A description or explanation of the element. – The records in which it is contained. – Its source. – The length and type of the field in which it is stored. – The programs in which it is used. – The outputs in which it is contained. – The authorized users of the element. – Other names for the element.
  • 33. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 33 of 96 DATABASE SYSTEMS  Accountants should participate in the development of the data dictionary because they have a good understanding of the data elements in a business organization, as well as where those elements originate and how they are used.
  • 34. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 34 of 96 DATABASE SYSTEMS • DBMS Languages –Every DBMS must provide a means of performing the three basic functions of: • Creating a database • Changing a database • Querying a database
  • 35. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 35 of 96 DATABASE SYSTEMS • Creating a database: – The set of commands used to create the database is known as data definition language (DDL). DDL is used to: • 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 records or fields
  • 36. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 36 of 96 DATABASE SYSTEMS • Changing a database – The set of commands used to change the database is known as data manipulation language (DML). DML is used for maintaining the data including: • Updating data • Inserting data • Deleting portions of the database
  • 37. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 37 of 96 DATABASE SYSTEMS • Querying a database: – The set of commands used to query the database is known as data query language (DQL). DQL is used to interrogate the database, including: • Retrieving records • Sorting records • Ordering records • Presenting subsets of the database – The DQL usually contains easy-to-use, powerful commands that enable users to satisfy their own information needs.
  • 38. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 38 of 96 DATABASE SYSTEMS • Report Writer – Many DBMS packages also include a report writer, a language that simplifies the creation of reports. – Users typically specify: • What elements they want printed • How the report should be formatted – The report writer then: • Searches the database • Extracts specified data • Prints them out according to specified format
  • 39. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 39 of 96 RELATIONAL DATABASES • A DBMS is characterized by the type of logical data model on which it is based. – A data model is an abstract representation of the contents of a database. – Most new DBMSs are called relational databases because they use the relational model developed by E. F. Codd in 1970.
  • 40. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 40 of 96 RELATIONAL DATABASES • The relational data model represents everything in the database as being stored in the forms of tables (aka, relations).
  • 41. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 41 of 96 Student ID Last Name First Name Phone No. 333-33-3333 Simpson Alice 333-3333 111-11-1111 Sanders Ned 444-4444 123-45-6789 Moore Artie 555-5555 STUDENTS 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 COURSES Relation 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 STUDENT x COURSE
  • 42. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 42 of 96 RELATIONAL DATABASES • This model only describes how the data appear in the conceptual- and external- level schemas. • The data are physically stored according to the description in the internal-level schema.
  • 43. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 43 of 96 Student ID Last Name First Name Phone No. 333-33-3333 Simpson Alice 333-3333 111-11-1111 Sanders Ned 444-4444 123-45-6789 Moore Artie 555-5555 STUDENTS 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 COURSES A primary key is the attribute or combination of attributes that uniquely identifies a specific row in a table. STUDENT x COURSE SCID 333333333-1234 333333333-1236 111111111-1235 111111111-1236
  • 44. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 44 of 96 STUDENT x COURSE SCID 333333333-1234 333333333-1236 111111111-1235 111111111-1236 Student ID Last Name First Name Phone No. 333-33-3333 Simpson Alice 333-3333 111-11-1111 Sanders Ned 444-4444 123-45-6789 Moore Artie 555-5555 STUDENTS 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 COURSES In some tables, two or more attributes may be joined to form the primary key.
  • 45. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 45 of 96 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 STUDENTS Student ID Last Name First Nam e Phone No. Advisor N o. 333-33-3333 Simpson Alice 333-3333 1418 111-11-1111 Sanders Ned 444-4444 1418 123-45-6789 Moore Artie 555-5555 1503 A foreign key is an attribute in one table that is a primary key in another table. Foreign keys are used to link tables together.
  • 46. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 46 of 96 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. STUDENTS Student ID Last Name First Nam e Phone No. Advisor N o. 333-33-3333 Simpson Alice 333-3333 1418 111-11-1111 Sanders Ned 444-4444 1418 123-45-6789 Moore Artie 555-5555 1503
  • 47. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 47 of 96 RELATIONAL DATABASES • Alternatives for storing data – One possible alternate approach would be to store all data in one uniform table. – For example, instead of separate tables for students and classes, we could store all data in one table and have a separate line for each student x class combination.
  • 48. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 48 of 96 Student ID Last Nam e First 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.
  • 49. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 49 of 96 Student ID Last Nam e First 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 • Suppose Alice Simpson changes her phone number. You need to make the change in three places. If you fail to change it in all three places or change it incorrectly in one place, then the records for Alice will be inconsistent. • This problem is referred to as an update anomaly.
  • 50. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 50 of 96 Student ID Last Nam e First 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 • What happens if you have a new student to add, but he hasn’t signed up for any courses yet? • Or what if there is a new class to add, but there are no students enrolled in it yet? In either case, the record will be partially blank. • This problem is referred to as an insert anomaly.
  • 51. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 51 of 96 Student ID Last Nam e First 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 • If Ned withdraws from all his classes and you eliminate all three of his rows from the table, then you will no longer have a record of Ned. If Ned is planning to take classes next semester, then you probably didn’t really want to delete all records of him. • This problem is referred to as a delete anomaly.
  • 52. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 52 of 96 STUDENT x COURSE SCID 333333333-1234 333333333-1236 111111111-1235 111111111-1236 Student ID Last Name First Name Phone No. 333-33-3333 Simpson Alice 333-3333 111-11-1111 Sanders Ned 444-4444 123-45-6789 Moore Artie 555-5555 STUDENTS 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 COURSES • The solution to the preceding problems is to use a set of tables in a relational database. • Each entity is stored in a separate table, and separate tables or foreign keys can be used to link the entities together.
  • 53. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 53 of 96 RELATIONAL DATABASES • Basic requirements of a relational database – Every column in a row must be single valued. • In other words, every cell can have one and only one value. • In the student table, you couldn’t have an attribute named “Phone Number” if a student could have multiple phone numbers. • There might be an attribute named “local phone number” and an attribute named “permanent phone number.” • You could not have an attribute named “Class” in the student table, because a student could take multiple classes.
  • 54. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 54 of 96 RELATIONAL DATABASES • Basic requirements of a relational database – The primary key cannot be null. • The primary key uniquely identifies a specific row in the table, so it cannot be null, and it must be unique for every record. • This rule is referred to as the entity integrity rule.
  • 55. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 55 of 96 STUDENT x COURSE SCID 333333333-1234 333333333-1236 111111111-1235 111111111-1236 Student ID Last Name First Name Phone No. 333-33-3333 Simpson Alice 333-3333 111-11-1111 Sanders Ned 444-4444 123-45-6789 Moore Artie 555-5555 STUDENTS 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 COURSES • Note that within each table, there are no duplicate primary keys and no null primary keys. • Consistent with the entity integrity rule.
  • 56. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 56 of 96 RELATIONAL DATABASES • Basic requirements of a relational database – A foreign key must either be null or correspond to the value of a primary key in another table. • This rule is referred to as the referential integrity rule. • The rule is necessary because foreign keys are used to link rows in one table to rows in another table.
  • 57. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 57 of 96 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 STUDENTS Student ID Last Name First Nam e Phone No. Advisor N o. 333-33-3333 Simpson Alice 333-3333 1418 111-11-1111 Sanders Ned 444-4444 1418 123-45-6789 Moore Artie 555-5555 1503 Advisor No. is a foreign key in the STUDENTS table. Every incident of Advisor No. in the STUDENTS table either matches an instance of the primary key in the ADVISORS table or is null.
  • 58. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 58 of 96 RELATIONAL DATABASES • Basic requirements of a relational database – All non-key attributes in a table should describe a characteristic of the object identified by the primary key. • Could nationality be a non-key attribute in the student table? • Could advisor’s nationality be a non-key attribute in the student table?
  • 59. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 59 of 96 RELATIONAL DATABASES • There are two basic ways to design well- structured relational databases. – Normalization – Semantic data modeling
  • 60. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 60 of 96 RELATIONAL DATABASES • Normalization – Starts with the assumption that everything is initially stored in one large table. – A set of rules is followed to decompose that initial table into a set of normalized tables. – Objective is to produce a set of tables in third- normal form (3NF) because such tables are free of update, insert, and delete anomalies. – Approach is beyond the scope of this book but can be found in any database textbook.
  • 61. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 61 of 96 RELATIONAL DATABASES • There are two basic ways to design well- structured relational databases. – Normalization – Semantic data modeling
  • 62. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 62 of 96 RELATIONAL DATABASES • Semantic data modeling (covered in REA datamodel) – Database designer uses knowledge about how business processes typically work and the information needs associated with transaction processing to draw a graphical picture of what should be included in the database. – The resulting graphic is used to create a set of relational tables that are in 3NF.
  • 63. © 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart 63 of 96 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.