AIS Chapter 4@stds
AIS Chapter 4@stds
Relational Databases
INTRODUCTION
• Questions to be addressed in this chapter:
– How are databases different than file-based legacy
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?
INTRODUCTION
STUDENTS
Phone
Student ID Last Name First Name Number Birth Date
STUDENTS
Phone
Student ID Last Name First Name Number Birth Date
STUDENTS
Phone
Student ID Last Name First Name Number Birth Date
STUDENTS
Phone
Student ID Last Name First Name Number Birth Date
Student Class
File File
Advisor
File
FILE VS. 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
Database
• The combination of
Fact A Fact B
Fact C Fact D the database, the
Fact E Fact F
DBMS, and the
application
Database
Management
programs that
System access the
database is
Enrollment
Program
Financial Aid
Program
Grades
Program
referred to as the
database system.
FILE VS. 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 • As technology
Management
System improves, many large
companies are
developing very large
Enrollment Financial Aid Grades
Program Program Program databases called data
warehouses.
IMPORTANCE AND ADVANTAGES OF
DATABASE SYSTEMS
• Database technology is everywhere.
– Most new AISs implement a database
approach.
– Virtually all mainframe computer sites use
database technology.
– Use of databases with PCs is growing also.
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.
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.
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.
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.
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.
IMPORTANCE AND ADVANTAGES OF
DATABASE SYSTEMS
• Database technology provides the
following benefits to organizations:
– Data integration
• Data items are independent of the programs that
use them.
– Data sharing
• Consequently, a data item can be changed
– Reporting flexibility
without changing the program and vice versa.
– Minimal •data
Makes programming easier and simplifies data
redundancy and inconsistencies
management.
– Data independence
IMPORTANCE AND ADVANTAGES OF
DATABASE SYSTEMS
• Database technology provides the
following benefits to organizations:
– Data integration
– Data sharing
– Reporting flexibility
• Data management is more efficient
– Minimal data redundancy and inconsistencies
because the database administrator is
responsible for coordinating, controlling,
– Data independence
and managing data.
– Central management of data
IMPORTANCE AND ADVANTAGES OF
DATABASE SYSTEMS
• Database technology provides the
following benefits to organizations:
– Data integration
– Data sharing
– Reporting flexibility
• Relationships can be explicitly defined and
– Minimal dataused
redundancy and inconsistencies
in the preparation of management
– Data independence
reports.
• EXAMPLE: Relationship between selling
– Central management of data campaigns.
costs and promotional
– Cross-functional analysis
IMPORTANCE AND ADVANTAGES OF
DATABASE SYSTEMS
• The importance of good data:
– Bad data leads to:
• Bad decisions
• Embarrassment
• Angry users
Data Warehousing Institute estimates that
dirty data costs $600 billion per year in
unnecessary postage, marketing costs, and
lost customer credibility.
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.
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.
DATABASE SYSTEMS
• Schemas
– A schema describes the logical structure of a
database.
– There are three levels of schema.
• Conceptual level• A low-level view of the database.
• External level • It describes how the data are actually
• Internal level stored and accessed including:
– Record layouts
– Definitions
– Addresses
– Indexes
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
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
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
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
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
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
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.
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
DATABASE SYSTEMS
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
RELATIONAL DATABASES
• 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.
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.
RELATIONAL DATABASES
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 • Note that within each table, there are no
333333333-1234 duplicate primary keys and no null
333333333-1236 primary keys.
111111111-1235 • Consistent with the entity integrity rule.
111111111-1236
RELATIONAL DATABASES
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