0% found this document useful (0 votes)
90 views71 pages

AIS CH3 (Relational Database)

This document provides an introduction to relational databases. It discusses the differences between file-based systems and database systems, explaining that databases were developed to address problems with proliferating master files. Relational databases organize data into tables and use a database management system to integrate data across different files. Databases treat data as an organizational resource and make it easier to obtain an organization-wide view of consistent data.
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)
90 views71 pages

AIS CH3 (Relational Database)

This document provides an introduction to relational databases. It discusses the differences between file-based systems and database systems, explaining that databases were developed to address problems with proliferating master files. Relational databases organize data into tables and use a database management system to integrate data across different files. Databases treat data as an organizational resource and make it easier to obtain an organization-wide view of consistent data.
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

GOLIS UNIVERSITY

COURSE: ACCOUNTING INFORMATION SYSTEM

CHAPTER 3: Relational data base

SEMESTER SIX: ACCOUNTING

INSTRUCTOR: ABDIHAKIM TIYARI ( BA, MBA, ACCA).


Contact: [email protected]
Phone number: 063-4075785

1
CHAPTER 3

Relational data base

2
INTRODUCTION

Questions to be addressed in this chapter:

How are databases different than file-based systems?


Why databases are 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? 3
INTRODUCTION
 Relational databases are used for 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 and relational data base.

4
FILE VS. DATABASES
• Let’s examine some basic principles about how data are
stored in computer systems.
– An entity is anything about which the organization
wishes to store data. At your college or university,
one entity would be the student.

STUDENTS

Phone
Student ID Last Name First Name Number Birth Date

333-33-3333 Samson Seleshe 333-3333 10/11/84

111-11-1111 Abebe Chine 444-4444 11/24/86

123-45-6789 Fugge Ferera 555-5555 04/20/85


5
FILE VS. DATABASES
– Information about the attributes of an entity
(e.g., the student’s ID number and birth date)
are stored in fields. A field is the physical space
where an attribute is stored.
STUDENTS

Phone
Student ID Last Name First Name Number Birth Date

333-33-3333 Samson Seleshe 333-3333 10/11/84

111-11-1111 Abebe Chine 444-4444 11/24/86

123-45-6789 Fugge Ferera 555-5555 04/20/85


6
FILE VS. DATABASES
– All the fields containing data about one entity (e.g.,
one student) form a record.
– The example below shows the record for Abebe Chine.

STUDENTS

Phone
Student ID Last Name First Name Number Birth Date

333-33-3333 Samson Seleshe 333-3333 10/11/84

111-11-1111 Abebe Chine 444-4444 11/24/86

123-45-6789 Fugge Ferera 555-5555 04/20/85


7
FILE VS. DATABASES
– A set of all related records forms a file (e.g., the student
file).
– If this university only had three students and five fields
for each student, then the entire file would be depicted
below.

STUDENTS
Phone
Student ID Last Name First Name Number Birth Date
333-33-3333 Samson Seleshe 333-3333 10/11/84
111-11-1111 Abebe Chine 444-4444 11/24/86
123-45-6789 Fugge Ferera 555-5555 04/20/85
8
FILE VS. DATABASES

– A master file is a file that stores cumulative information about an


organization’s entities.

– A set of interrelated, centrally coordinated files forms a database.

Student Class
File File

Advisor
File
9
FILE VS. DATABASES
• Database systems were developed to address the
problems associated with the proliferation of
master files.
– For years, each time when a new information
need arose, companies created new files and
programs.
– The result: a significant increase in the number
of master files.

10
FILE VS. DATABASES
• This proliferation of master files
created problems:
Master File 1 Enrollment – Often the same information
Fact A
Fact B
Program was stored in multiple master
Fact C files.
– Made it more difficult to
effectively integrate data and
Master File 2
Fin. Aid
obtain an organization-wide
Fact A
Fact D Program view of the data.
Fact F – Also, the same information
may not have been consistent
between files.
Master File 3
Fact A
Grades e.g. If a student changed his
Program
Fact B phone number, it may have
Fact F been updated in one master
file but not another.
11
FILE VS. DATABASES
Database • Database systems
Fact A Fact B
Fact C Fact D were developed to
Fact E Fact F address the above
stated problems
Database
Management
System

Enrollment Fin. Aid Grades


Program Program Program

12
FILE VS. DATABASES
• The database approach treats
Database
Fact A Fact B data as an organizational
Fact C Fact D resource that should be used
Fact E Fact F by entire organization and
managed for the entire
organization,
Database
Management • Data is not just a particular
System department.
• A database management
system (DBMS) serves as
Enrollment
Program
Fin. Aid
Program
Grades
Program
the interface between the
database and the various
application programs.
13
FILE VS. DATABASES
Database • The combination of
Fact A Fact B
Fact C Fact D the database, the
Fact E Fact F DBMS, and the
application programs
Database
Management
that access the
System database is referred
to as the database
Enrollment
Program
Fin. Aid
Program
Grades
Program
system.

14
FILE VS. DATABASES
Database • The person responsible
Fact A Fact B for the database is the
Fact C Fact D
Fact E Fact F database
administrator.
Database • As technology
Management
System
improves, many large
companies are
Enrollment Fin. Aid Grades
developing very large
Program Program Program databases called data
warehouses.
15
IMPORTANCE AND ADVANTAGES OF DATABASE
SYSTEMS

• Database technology is every where.


– Most new AISs implement a database
approach.
– Virtually all mainframe computer sites use
database technology.
– Use of databases with PCs is growing also.

16
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.
17
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.

18
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.

19
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. 20
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.
21
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

22
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
– Central management of data
• Data management is more efficient because the
database administrator is responsible for coordinating,
controlling, and managing data.
23
IMPORTANCE AND ADVANTAGES OF DATABASE SYSTEMS
• Database technology provides the following
benefits to organizations:
• Relationships can be
– Data integration
explicitly defined and
– Data sharing used in the preparation
– Reporting flexibility of management
reports.
– Minimal data redundancy and inconsistencies
• EXAMPLE:
– Central management of data Relationship between
– Cross-functional analysis selling costs and
promotional
campaigns.
24
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.

25
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.

26
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.

27
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.

28
Logical View—User A Logical View—User B
Enrollment by Class Scholarship Distribution
Fr.
5%
Sr. Soph.
33% 24%

Jr.
38%

DBMS The DBMS


translates users’
logical views into
Operating
System
instructions as to
which data should
be retrieved from
Database the database.
29
Logical View—User A Logical View—User B
Enrollment by Class Scholarship Distribution
Fr.
5%
Sr. Soph.
33% 24%

Jr.
38%

DBMS The operating


system translates
DBMS requests
Operating
System into instructions to
physically retrieve
data from various
Database disks.
30
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.

31
DATABASE SYSTEMS
• Separating the logical and physical views of
data also means users can change their
conceptualizations of the data relationships
without making changes in the physical
storage.
• The database administrator can also change
the physical storage of the data without
affecting users or application programs.

32
DATABASE SYSTEMS
• Schemas
– A schema describes the logical structure of a
database.
– There are three levels of schema.
• Conceptual level schema
• The organization-wide view of the
entire database—i.e., the big picture.
• Lists all data elements and the
relationships between them.
33
DATABASE SYSTEMS
• Schemas
– A schema describes the logical structure of a
database.
– There are three levels of schema.
• Conceptual level schema
• External level schema
• 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. 34
DATABASE SYSTEMS
• Schemas
– A schema describes the logical structure of a
database.
– There are three levels of schema.
• Conceptual level schema
• External level schema
• Internal level schema
• A low-level view of the database. Includes specific elements:
– Record layouts
– Definitions
– Addresses
– Indexes 35
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.
36
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.

37
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. 38
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.

39
DATABASE SYSTEMS
The DBMS usually maintains the data
dictionary.
– It is often one of the first applications of a
newly implemented database system.
– Inputs to the dictionary include:
• Records of new or deleted data
elements.
• Changes in names, descriptions, or uses
of existing elements.
– Outputs include:
• Reports that are useful to programmers,
database designers, and AIS users. 40
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

41
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

42
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 43
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

44
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

45
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

46
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.
47
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

48
DATABASE SYSTEMS

• Users typically have access to both DQL and


report writer.
• Access to DDL and DML are typically
restricted to employees with administrative
and programming responsibilities.

49
RELATIONAL DATABASES
• 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
data model developed by E.F. Codd in
1970.

50
RELATIONAL DATABASES
• The relational data model represents
everything in the database as being stored
in the forms of tables (aka, relations).

51
STUDENTS
Last First
Student ID Name Name
333-33-3333 Samson Alemu
Relation
111-11-1111 Senait Negadras
123-45-6789 Meron Aseged

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

• 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.

53
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Samson Alemu 333-3333
111-11-1111 Asenafi Negadras 444-4444
123-45-6789 Tilahun Aseged 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
333333333-1236
111111111-1235
111111111-1236
Each row contains
STUDENTS
Last First Phone
data about a
Student ID Name Name No. specific
333-33-3333 Samson Alemu 333-3333 occurrence of the
111-11-1111 Asenafi Negadras 444-4444 type of entity in
123-45-6789 Tilahun Aseged 555-5555 the table.
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
333333333-1236
111111111-1235
111111111-1236
Each column in
STUDENTS
Last First Phone
a table contains
Student ID Name Name No. information
333-33-3333 Samson Alemu 333-3333 about a specific
111-11-1111 Asenafi Negadras 444-4444 attribute of the
123-45-6789 Tilahun Aseged 555-5555 entity.
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
333333333-1236
111111111-1235
111111111-1236
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Samson Alemu 333-3333
111-11-1111 Asenafi Negadras 444-4444
123-45-6789 Tilahun Aseged 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
A primary key is the
333333333-1234 attribute or combination of
333333333-1236 attributes that uniquely
111111111-1235
identifies a specific row in a
111111111-1236
table.
STUDENTS
Last First
Student ID Name Name
333-33-3333 Samson Alemu
111-11-1111 Asenafi Negadras
123-45-6789 Tilahun Aseged

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
333333333-1236 attributes may be joined to form
111111111-1235 the primary key.
111111111-1236
STUDENTS
First Advisor
Student ID Last Name Name Phone No. No.
333-33-3333 Samson Alemu 333-3333 1418
111-11-1111 Asenafi Negadras 444-4444 1418
123-45-6789 Tilahun Aseged 555-5555 1503

ADVISORS
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Mengesha Almawu 316
1503 Zenebe Zinabu 202
1506 Robel Jigsaw 203

A foreign key is an attribute in one table and it is a


primary key in another table.
STUDENTS
First Advisor
Student ID Last Name Name Phone No. No.
333-33-3333 Samson Alemu 333-3333 1418
111-11-1111 Asenafi Negadras 444-4444 1418
123-45-6789 Tilahun Aseged 555-5555 1503

ADVISORS
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Mengesha Almawu 316
1503 Zenebe Zinabu 202
1506 Robel Jigsaw 203

Foreign keys are used to link tables


together.
STUDENTS
First Advisor
Student ID Last Name Name Phone No. No.
333-33-3333 Samson Alemu 333-3333 1418
111-11-1111 Asenafi Negadras 444-4444 1418
123-45-6789 Tilahun Aseged 555-5555 1503

ADVISORS
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Mengesha Almawu 316
1503 Zenebe Zinabu 202
1506 Robel Jigsaw 203

Other non-key attributes in each table store


important information about the entity.
RELATIONAL DATABASES
 Basic Requirements of a Relational Database
A. 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.
62
RELATIONAL DATABASES
• Basic Requirements of a Relational
Database
B. 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.
63
Last First Phone
Student ID Name Name No.
333-33-3333 Samson Alemu 333-3333
111-11-1111 Ashenafi Negadras 444-4444
123-45-6789 Tilahun Aseged 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 • 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
• Basic Requirements of a Relational Database
C. 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.
65
STUDENTS
First Advisor
Student ID Last Name Name Phone No. No.
333-33-3333 Samson Alemu 333-3333 1418
111-11-1111 Ashenafi Negadras 444-4444 1418
123-45-6789 Tilahun Aseged 555-5555 1503

ADVISORS
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Mengesha Almawu 316
1503 Zenebe Zinabu 202
1506 Robel Jigsaw 203

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.
RELATIONAL DATABASES
• Basic Requirements of a Relational
Database
D. All non-key attributes in a table should
describe a characteristic of the object
identified by the primary key.

67
DATABASE SYSTEMS AND THE FUTURE OF
ACCOUNTING
• Database systems may profoundly affect the
fundamental nature of accounting:
May lead to abandonment of double-entry
accounting, because the redundancy of the
double entry is not necessary in computer data
processing.
May also alter the nature of external reporting.
• EXAMPLE: External users could have
access to the company’s database and
manipulate the data to meet their own
reporting needs.
68
DATABASE SYSTEMS AND THE FUTURE OF
ACCOUNTING
 To enhanced the use of accounting
information in decision making and to over
come the above problems:
 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.
69
DATABASE SYSTEMS AND THE FUTURE
OF ACCOUNTING
Powerful querying capabilities that
accompany database packages should be
implemented.
The ability to accommodate multiple views
of the same underlying phenomenon.
The ability to integrate financial and
operational data.

70
End of chapter three

71

You might also like