You are on page 1of 25

Accounting Information Systems (2)

Lecture (1)
Fourth Year
Groups D, E & F
Second Semester 2020-2021
Chapter (4) Relational Databases
Part Dr. Ahmed Mokhtar

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 1


Learning Objectives
• Explain the importance and advantages of databases, as
well as the difference between database and file-based
legacy systems.
• Explain database systems, including logical and physical
views, schemas, the data dictionary, and DBMS
languages.
• Describe what a relational database is, how it organizes
data, and how to create a set of well-structured relational
database tables.

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 2


What Is a Database?
• Efficiently and centrally coordinates information for a
related group of files
• A file is a related group of records
• A record is a related group of fields
• A field is a specific attribute of
interest for the entity (record)

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 3


• database - A set of interrelated, centrally coordinated data
tables stored electronically with as little data redundancy
as possible.
• A database is a large collection of organized data that
can be accessed by multiple users and used by many
different computer applications.
• A database management system (DBMS) is the
program that manages and controls the data and the
interfaces between the data and the application
programs that use the data stored in the database. The
database, the DBMS, and the application programs that
access the database through the DBMS are referred to as
the database system.

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 4


File-Oriented Systems versus Database Systems

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 5


• The Data Hierarchy. Storing accounting data in
databases involves organizing the data into a logical
structure In ascending order, this data hierarchy is
data field→ record →file → database
• The first level in the data hierarchy is a data field, which
is information that describes a person, event, or thing in
the database. In a payroll file, for example, data fields
would include employee names, employee identification
numbers, and pay rates for the employees. Other names
for a data field are attribute, column, or simply field.
• The second level. A database record (also called a tuple)
stores all of the information about one entity (i.e., person,
event, or thing). For example, all of the information about
one inventory part in an inventory file, one employee in a
payroll file, or one customer in a customer file.
Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 6
• At the third level of the data hierarchy, a set of common
records forms a file, or using database and Microsoft
Access terminology, a table. Thus, a file or table contains a
set of related records—for example, a set of customer
records or inventory records. Master files typically store
permanent information—for example, part numbers, part
descriptions, and location codes for the individual records
in an inventory parts master file. Transaction files
typically store transient information—for example,
inventory disbursements and replenishments for a
specific period.

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 7


• Database Keys.
1- The primary key is the data field in each record that
uniquely distinguishes one record from another in a
database table. Primary keys are required for every record
in a database and they are unique.
A primary key is the database attribute, or combination
of attributes, that uniquely identifies a specific row in a
table.
2- Foreign key - An attribute in a table that is also a primary
key in another table; used to link the two tables.
• Some accounting records contain data fields called
foreign keys that enable them to reference one or more
records in other tables. The foreign key in one table always
matches the primary key of the related table.

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 8


Advantages of Databases
• Data is integrated
• Data sharing
• Minimize data redundancy and inconsistencies
• Data is independent of the programs that use the data
• Data is easily accessed for reporting and cross-functional
analysis

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 9


Significance of Databases
• Critical information. The information stored in an
organization’s databases is sometimes its most important
and valuable asset.
• Volume. Many firms’ databases are truly enormous.
• Distribution. The databases of some organizations are
centralized (i.e., data is stored in a single location). Many
other databases, however, are distributed (i.e., duplicated
in local or regional computers as processing needs
dictate). Distributing data can make it difficult to (1) ensure
data accuracy, consistency, completeness, and (2) secure
information from unauthorized access.
• Privacy. Databases often contain sensitive information

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 10


• Irreplaceable data. The information contained in most
accounting databases is unique to the organization that
created it and is typically priceless. Many organizations
would fail shortly after losing the information contained in
their accounting databases.
• Need for accuracy. The data stored in databases must be
complete, comprehensive, and accurate.
• Internet uses. As you might imagine, databases are critical
components of both internal and external corporate Web
systems. Databases store information related to product
information for online catalog sales, e-mails, product
registration data, employment opportunities, stock prices,
and so on.

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 11


Database Users and Designers
• Different users of the database information are at an
external level of the database. These users have logical
views of the data.
• At an internal level of the database is the physical view
of the data which is how the data is actually physically
stored in the system.
• Designers of a database need to understand user’s needs
and the conceptual level of the entire database as well as
the physical view.

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 12


Schemas
• Conceptual-level—organization wide view
• External-level—individual user’s view
• Internal-level—low level view

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 13


Database Design
• To design a database, you need to have a conceptual
view of the entire database. The conceptual view
illustrates the different files and relationships between the
files.
• The data dictionary is a “blueprint” of the structure of the
database and includes data elements, field types, pro
grams that use the data element, outputs, and so on.
• A data dictionary contains information about the
structure of the database.

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 14


DBMS Languages
• Data Definition Language (DDL)
– Builds the data dictionary
– Creates the database
– Describes logical views for each user
– Specifies record or field security constraints
• Data Manipulation Language (DML)
– Changes the content in the database
 Creates, updates, insertions, and deletions

• Data Query Language (DQL)


– Enables users to retrieve, sort, and display specific data from the
database

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 15


Relational Database
• Represents the conceptual and external schema as if that
“data view” were truly stored in one table.
• Although the conceptual view appears to the user that this
information is in one big table, it really is a set of tables
that relate to one another.

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 16


Conceptual View Example

Customer Name Sales Invoice # Invoice Total

D. Ainge 101 $1,447

G. Kite 102 $4,394

D. Ainge 103 $ 898

G. Kite 104 $ 789

F. Roberts 105 $3,994

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 17


Relational Data Tables (1 of 2)

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 18


Relational Data Tables (2 of 2)

Primary Keys
Foreign Key (Customer # is a Foreign key
in the Sales table because it is a Primary
key that uniquely identifies Customers in
the Customer table). Because of this, the
Sales table can relate to the Customer table
(see red arrow above).

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 19


Relational Database Design Rules

• Every column in a row must be single valued


• Primary key cannot be null (empty) also known as entity integrity
• If a foreign key is not null, it must have a value that corresponds to the
value of a primary key in another table (referential integrity)
• All other attributes in the table must describe characteristics of the
object identified by the primary key
Following these rules allows databases to be normalized and solves the
update, insert, and delete anomalies.
Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 20
Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 21
• update anomaly – Improper database organization where
a non-primary key item is stored multiple times; updating
the item in one location and not the others causes data
inconsistencies.
• insert anomaly - Improper database organization that
results in the inability to add records to a database.
• delete anomaly – Improper organization of a database that
results in the loss of all information about an entity when a
row is deleted.

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 22


Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 23
Key Terms (1 of 2)
• Database • External-level schema
• Database management system • Subschema
(DBMS) • Internal-level schema
• Database system • Data dictionary
• Database administrator (DBA) • Data definition language (DDL)
• Data warehouse • Data manipulation language (DML)
• Business intelligence • Data query language (DQL)
• Online analytical processing (OLAP) • Report writer
• Data mining • Data model
• Record layout • Relational data model
• Logical view • Tuple
• Physical view • Primary key
• Schema • Foreign key
• Conceptual-level schema

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 24


Key Terms (2 of 2)
• Update anomaly
• Insert anomaly
• Delete anomaly
• Relational database
• Entity integrity rule
• Referential integrity rule
• Normalization
• Semantic data modeling

Copyright © 2018 Pearson Education, Ltd. Chapter 4: Relational Databases Slide 1 - 25

You might also like