0% found this document useful (0 votes)
131 views54 pages

Chapter 4 Relational Databases and Enterprise Systems

This document provides an overview of relational databases and enterprise systems. It begins by listing the key learning objectives, which include describing advantages of relational databases, explaining relational database principles, querying with SQL, and understanding enterprise systems and cloud computing. The document then covers topics such as the definition of a database, advantages of the relational model, database management systems, data dictionaries, database administrators, and implementing a relational database using Microsoft Access and the REA data model.

Uploaded by

Rotanak Um
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)
131 views54 pages

Chapter 4 Relational Databases and Enterprise Systems

This document provides an overview of relational databases and enterprise systems. It begins by listing the key learning objectives, which include describing advantages of relational databases, explaining relational database principles, querying with SQL, and understanding enterprise systems and cloud computing. The document then covers topics such as the definition of a database, advantages of the relational model, database management systems, data dictionaries, database administrators, and implementing a relational database using Microsoft Access and the REA data model.

Uploaded by

Rotanak Um
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
You are on page 1/ 54

Chapter

4
Relational
Databases and
Enterprise
Systems
Learning Objectives

LO 4-1 Describe the advantages of relational databases.


LO 4-2 Explain basic relational database principles.
LO 4-3 Describe how to query using Structured Query Language (SQL).
LO 4-4 Understand the purpose and basic framework for an enterprise system.
LO 4-5 Assess how cloud computing facilitates enterprise systems.

© McGraw Hill
LO 1

Introduction of Database 1

A database is a collection of related data for various uses.


Three types of data models:
• A Hierarchical data model organizes data into a tree-like structure that allows
repeating information using defined parent/child relationships.
• A Network data model is a flexible model representing objects and their
relationships.
• A Relational data model is a data model that stores information in the form of
related two-dimensional tables.

© McGraw Hill
LO 1

Introduction of Database 2

• Relational data model allows designers and users to identify relationships at


the time the database is created or much later whenever new informational
requirements from the data model are desired.
• While hierarchical and network data models require relationships to be formed
at the database creation, relational data models can be made up as needed.

4-4
© McGraw Hill
LO 2

Introduction of Database 3

Relational data models offer many advantages over other data models,
including:
• Flexibility and Scalability: handle changes quickly and easily (for example, SAP,
Oracle, Microsoft, etc.).
• Simplicity: easy to communicate to both database users and database
developers.
• Reduced Information Redundancy: requires each piece of data to be recorded
only in one place.

© McGraw Hill
LO 2

Definitions for Databases 1

Database Management System (D BMS)


• A computer program that creates, modifies, and queries the database.
• Designed to manage a database’s storage and retrieval of information.

© McGraw Hill
LO 2

Definitions for Databases 2

Data Dictionary:
• Describes the data fields in each database record such as field
description, field length, field type (for example, alphanumeric,
numeric), etc.

Database Administrator:
• The person responsible for the design, implementation, repair and
security of a firm’s database.

© McGraw Hill
LO 2

Fundamentals of Relational Databases 1

Examples of Entities and Attributes

Entities:
• Resources. • Cash, products.
• Events. • Sales, purchases.
• Agents. • Customers, salespeople.

Attributes:
• Characteristics. • Customer ID, Address, Name.

• Properties. • Invoice Number, Date.

• Adjectives. • Product name, Price.

© McGraw Hill
LO 2

Fundamentals of Relational Databases 2

Entities and Attributes


Three main constructs in a relational database

© McGraw Hill
LO 2

Fundamentals of Relational Databases 3

Illustration of a Relational
Database Using Primary and
Foreign Keys

© McGraw Hill
LO 2

Fundamentals of Relational Databases 4

Keys and Relationships:


• Primary key: uniquely
identifies a specific row in a
table.

Foreign key:
• Attribute in one table that
acts as primary key in
another table.
• Provides a logical
relationship, or a link,
between two tables.

© McGraw Hill
LO 2

Fundamentals of Relational Databases 5

Basic Requirements of Tables


• The Entity Integrity Rule: the primary key must have data values (cannot be null).
• The Referential Integrity Rule: the data value for a foreign key must either be null or
match one of the data values that already exists in the corresponding table.
• Each attribute: unique name.
• Value of each attribute: same type.
• Each attribute (column) of a record (row): single-valued.
• All other nonkey attributes: describe a characteristic of the class (table) identified by the
primary key.
© McGraw Hill
LO 2

Using Microsoft Access to Implement a


Relational Database

Introduction to Microsoft Access


• Access is a simple database management system that can be used to run
databases for individuals and small firms.

© McGraw Hill
LO 2

Microsoft Access Objects

1. Tables: store data which consists of a series of rows (records) and columns (attributes) connected by
relationships (links between tables by foreign keys).
2. Queries: retrieve and display data derived from records stored within the database.
3. Forms: enter data into tables and view existing records, powered by queries.
4. Reports: integrate data from one or more queries and tables, cannot edit database info.
5. Pages: web-based forms, data can be entered in real time from outside of the database system.
6. Macros: automate processes like opening a specific form.
7. Modules: alter Access’s code.

© McGraw Hill
LO 2

REA Data Model for Steve’s Stylin’


Sunglasses’ (SSS) Sales Process

© McGraw Hill
LO 2

Explanations on the Multiplicities


regarding the Sales Event 1

A. SSS may sell B. Every pair of C. A salesperson (new) may D. Only one salesperson
minimum one glasses created could not handle any sale greets and assists a
and maximum be sold once only. transaction yet, and at customer of the sale
many pairs of Zero means a pair most each salesperson transaction.
glasses in a sales designed already but could handle many sale
transaction. not sold yet. transactions.

© McGraw Hill
LO 2

Explanations on the Multiplicities


regarding the Sales Event 2

E. Each customer in the database has F. Each sale involves one


made at least one transaction and and only one customer.
most many transactions with SSS.
Customer data are recorded after the
first purchase.
© McGraw Hill
LO 2

Explanations on the Multiplicities regarding


the Cash Receipt Event 1

A. Each cash B. Each bank C. SSS will have D. Each cash


receipt is deposited account could have many cash receipts receipt is from
in one and only no deposit or many from one customer. only one
one bank account. deposits from the The “1” means a customer.
cash receipt event. down payment is
required.

© McGraw Hill
LO 2

Explanations on the Multiplicities regarding


the Cash Receipt Event 2

E. A cashier (new) may not handle F. Each cash receipt (for example,
any cash receipt yet, or a cashier a check from a customer) is
could take charge of many cash handled by only one cashier.
receipts.

© McGraw Hill
LO 2

Explanations on the Multiplicities between the Sales and


Cash Receipt Events

B. Each sale transaction may have at least one cash


A. Each cash receipt is for only receipt (that is, a down payment is required), and at
one sale transaction. most many cash receipts from customers (that is,
installment sales).

© McGraw Hill
LO 2

Using Microsoft Access to Implement a


Simple Database 1

Illustration: Steve’s Stylin’ Sunglasses


Step 1. Open Access.
Step 2. File -> New -> Blank desktop database.

© McGraw Hill
LO 2

Using Microsoft Access to Implement a


Simple Database 2

Step 3. File -> Save Database As, then save the database as ‘SSS.’
You will likely get a message saying, “All objects must be closed before
you save the database.” Click “Yes.”

Step 4. Ensure that the ribbon marked “Enable content” is enabled.


© McGraw Hill
LO 2

Using Microsoft Access to Implement a


Simple Database 3

Creating New Tables in Access


Step 1. Create  Table. (Note: The Table Design button will create a table and
open it in Design View.)

© McGraw Hill
LO 2

Using Microsoft Access to Implement a


Simple Database 4

Step 2. Click the tab Home  View (dropdown menu)  Design View.

© McGraw Hill
LO 2

Using Microsoft Access to Implement a


Simple Database 5

Note the Field Name, Data type, Description columns. You will use these to
configure the Customer table.

© McGraw Hill
LO 2

Using Microsoft Access to Implement a


Step 3.
Simple Database 6

• The first attribute of Customer Table will be its primary key.


• Highlight ID in the Field Name column and change it to “Customer
Number.” You should see a key icon next to the Customer Number.
• Or right click and select “Primary Key” or look for the primary key button
on the design tab of the ribbon.

A field name may contain 64


characters and may not
contain periods, exclamation
points or brackets because
they are used in Visual Basic
scripts.

© McGraw Hill
LO 2

Using Microsoft Access to Implement a


Simple Database 7

Step 4. Click on the dropdown button for the Data Type and select Number. This will
force any data entered into this field to be in the form of a number.

Step 5. • Set Field Properties for each attribute. For example: for Customer
Number we would set the Field Size to Long Integer, the Validation Rule to
‘Like “######” to ensure that all Customer Numbers are 6 numbers long.
• Since this is a primary key, choose the Required field as “Yes” and the
Indexed field as “Yes (No Duplicates).”

© McGraw Hill
LO 2

Using Microsoft Access to Implement a


Simple Database 8

Step 6. For some fields, it is


appropriate to use an Input Mask.
For example: Select the attribute
Customer Zip and click in the Input
Mask area in the Field Properties
box. You will see to the right a
button with “…” on it. Click this
button to bring up the Input Mask
Wizard. Select Zip Code from the
menu and click Next and Finish.

© McGraw Hill
LO 2

Using Microsoft Access to Implement a


Simple Database 9

Step 7. Input the remaining fields for the


Customer Table
To insert a row, left click on a row where
you would like to insert a new row. Right
click to bring up a drop-down menu. Left
click on Insert Row.

Step 8. When you create the Inventory


Table, you want to include Sale Number
as a foreign key to implement
relationship.

© McGraw Hill
LO 2

Using Microsoft Access to Implement a


Simple Database 10

Step 9. • Create the rest of the tables and attributes given before, using
appropriate data types and properties.
• Generally, validation rules are used for primary keys.
• For other fields such as Sales Date in the Sales table you will also use
Input Masks.

© McGraw Hill
LO 2

Using Microsoft Access to Implement a


Simple Database 11

Creating Relationships in Access


Step 1. Click Database Tools 
Relationships.
Step 2. • Click the Show Table button in the
Design tab. Select all your tables and
press the Add button.
• Arrange the tables in the form similar
to the data model.

Step 3. • Click each primary key that you want


to link and drag it to its respective
foreign key in another table.
• Be sure to check the “Enforce
Referential Integrity” box for each
relationship.
© McGraw Hill
LO 2

Using Microsoft Access to Implement a


Simple Database 12

© McGraw Hill
LO 3

Structured Query Language (SQL) 1

• SQL (usually pronounced "Sequel") stands for Structured Query Language


• A computer language designed to query data in a relational database
• Based on relational algebra and allows a user to query and update the database
• Queries allow the user to access, read, and report on desired data but the
responsibility of making physical changes to the relational database belongs to the
Database Management System
• SQL uses these operators and clauses:

INSERT operator: create new record


SELECT operator: begin a query, most useful operator in S QL, tells the query which
columns (or attributes) of a table should be included in the query
UPDATE operator: update record
DELETE operator: delete existing record

© McGraw Hill
LO 3

Structured Query Language (SQL) 2

FROM
• Clause added to the SELECT statement.
• Indicates the name of table(s) from which to retrieve data.

SELECT
• Used to begin a query.
• Statement tells the query which columns (or attributes) of a table
should be included in the query.

© McGraw Hill
LO 3

Structured Query Language (SQL) 3

SQL Example #1: Given the


attributes in the Customer table,
how do you use a query to find
FROM clause the salesperson for each
customer?
• Added to the SELECT
statement. Customer# Name A/R Amt SP#

C-1 Bill 345 E-12


• Indicates the name of table(s)
from which to retrieve data. C-2 Mick 225 E-10

C-3 Keith 718 E-10

C-4 Charlie 828 E-99

C-5 Ron 3,200 E-10

© McGraw Hill
LO 3

Structured Query Language (SQL) 4

SELECT Customer #, Name, SP#


FROM Customer;
We will get the following query result:

Customer# Name SP#

C-1 Bill E-12

C-2 Mick E-10

C-3 Keith E-10

C-4 Charlie E-99

C-5 Ron E-10

© McGraw Hill
LO 3

Structured Query Language (SQL) 5

WHERE clause SQL Example #2: How do you


retrieve all cash receipt
• States the criteria that information for customer C-2
must be met to be from the “Cash Receipt” table?
shown in the query
result.

Remittance Bank Customer Cashier


Advice# Amount Account# Date Number Number
RA-1 1,666 BA-6 25-JUL-2020 C-2 E-39
RA-2 10,000 BA-7 26-JUL-2020 C-2 E-39
RA-3 72,000 BA-7 15-AUG-2020 C-1 E-39
RA-4 32,600 BA-7 15-AUG-2020 C-5 E-39
RA-5 1,669 BA-6 25-AUG-2020 C-2 E-39

© McGraw Hill
LO 3

Structured Query Language (SQL) 6

SELECT * (asterisk indicating all columns should be selected)


FROM [Cash Receipt]
WHERE [Customer Number] = ’C-2’
We will get the following query result:
Remittance Bank Customer Cashier
Advice# Amount Account# Date Number Number
RA-1 1,666 BA-6 25-JUL-2020 C-2 E-39
RA-5 1,669 BA-6 25-AUG-2020 C-2 E-39
RA-2 10,000 BA-7 26-JUL-2020 C-2 E-39

Search criteria using relational operator- the BETWEEN operator and the LIKE
operator.

© McGraw Hill
LO 3

Structured Query Language (SQL) 7

• SQL Example #3: Assume you would like to use a query to find
the salesperson for each customer, and you would like to show
the name of each salesperson as part of the result.
Customer# Name A/R Amt SP# SP# SP_Name
C-1 Bill 345 E-12 E-10 Howard
C-2 Mick 225 E-10 E-12 Pattie
C-3 Keith 718 E-10
E-34 Stephanie
C-4 Charlie 828 E-99
C-5 Ron 3,200 E-10 E-99 David

© McGraw Hill
LO 3

Structured Query Language (SQL) 8

SELECT Customer#, Name, SP#, SP_Name


FROM Customer, Salesperson
WHERE Customer.SP#=Salesperon. SP#;
We will get the following query result:
Customer# Name SP# SP_Name
C-1 Bill E-12 Pattie
C-2 Mick E-10 Howard
C-3 Keith E-10 Howard
C-4 Charlie E-99 David
C-5 Ron E-10 Howard

Include WHERE to link 2 tables, SP# is a foreign key

© McGraw Hill
LO 3

Structured Query Language (SQL) 9

GROUP BY operator SQL Example #4: Refer to the


• Is used with aggregate Cash Receipt table in SQL
functions on the query Example #2. Assume you
results based on one or
more columns. would like to know the total
cash receipt amount from
each customer.

© McGraw Hill
LO 3

Structured Query Language (SQL) 10

SELECT [Customer Number], SUM(Amount)


FROM [Cash Receipt]
GROUP BY [Customer Number];
We will get the following query result:

Customer Number Amount


C-2 13,335
C-1 72,000
C-5 32,600

© McGraw Hill
LO 3

Structured Query Language (SQL) 11

ORDER BY clause SQL Example #5: Refer to the


• Identifies which Cash Receipt table in SQL
columns are used to Example #2. If we use the
sort the resulting data.
following SQL commands
• Without it, the order of instead, the amount of cash
rows returned by a SQL
query will not be receipt would be ordered in
defined. ascending amount (ASC) or
descending amount (DESC).

4-43
© McGraw Hill
LO 3

Structured Query Language (SQL) 12

SELECT *
FROM [Cash Receipt]
WHERE [Customer Number] = ‘C-2’
ORDER BY Amount ASC;
We will get the following query result:

Remittance   Bank   Customer Cashier


Advice# Amount Account# Date Number Number
RA-1 1,666 BA-6 25-JUL-2014 C-2 E-39
RA-5 1,669 BA-6 25-AUG-2014 C-2 E-39
RA-2 10,000 BA-7 26-JUL-2014 C-2 E-39

© McGraw Hill
LO 3

Structured Query Language (SQL) 13

SELECT DISTINCT BETWEEN


• Clause selects a column • Operator can be used to
without showing
repetitive values. specify the end points of a
range.

Example: You can retrieve each Example: Finding out cash receipt
customer number once from the entries made in July.
Cash Receipt table.
FROM [Cash Receipt]
SELECT DISTINCT [Customer Number] WHERE Date BETWEEN ‘01-JUL-2020’
FROM [Cash Receipt]; AND ‘31-JUL-2020’;

© McGraw Hill
LO 3

Structured Query Language (SQL) 14

Membership operator (IN) Example: Assume you would like to know


the total cash receipt amount from
• Allows you to test customers C-1 and C-2.
whether a data value
SELECT [Customer Number], SUM(Amount)
matches the specified
FROM [Cash Receipt]
target values. WHERE [Customer Number] IN (‘C-1’, ‘C-2’)
GROUP BY [Customer Number];

Customer
Number Amount
C-1 72,000
C-2 13,335

© McGraw Hill
LO 3

Structured Query Language (SQL) 15

Six Relational Operators in SQL

= != or <> < <= > >=

• equal • not • less • less • greater • greater


equal than than than than or
or equal to
equal
to

© McGraw Hill
LO 3

Structured Query Language (SQL) 16

Aggregate Functions in SQL

AVG(X) SUM(X) MAX(X) MIN(X COUNT(X)

• Average • Summation • Maximum • Minimum • Number of


of of all rows value of value of rows that
column that satisfy column X. column X. satisfy the
X. the given
selection condition.
criteria for
column X.

© McGraw Hill
LO 4

Enterprise Systems 1

• a.k.a. Enterprise Resource Planning (ERP) systems.


• Commercialized information systems.
• Integrate and automate business processes across a firm’s
value chain.
• Located within and across organizations.
• Typically use relational data model.
• Primary and foreign keys link the hundreds of tables that form
the basis for the enterprise system.

Example: SAP/ERP, Oracle ERP, Microsoft Dynamics.


© McGraw Hill
LO 4

Enterprise Systems 2

Did you know?


In fact, for a popular ERP product (SAP/ERP)
installation, there are 10,000 tables that are all linked
to each other!

© McGraw Hill
LO 4

Enterprise Systems 3

Enterprise Systems:
Serve as the backbone of the company’s internal business processes.
Serve as a connection with the external business processes for supply chain and customer
relationship management systems.
Accommodate integration and support of various business processes and information needs.
Give a higher level of internal transparency compared to the typically isolated legacy systems.
Provide informational benefits needed to manage effectively an organization’s business
activities.
• Timeliness of information.
• Transparency.
• Enhanced completeness.

© McGraw Hill
LO 4

Enterprise Systems 4

Challenges of Implementation
Integrating:
• Various modules within the enterprise system.
• With external systems such as the information system of a supplier and/or
customer.
• With the firm’s own existing legacy systems.

Converting:
• Data from existing legacy systems to the enterprise system.

Implementing:
• Any big project at a firm.

© McGraw Hill
LO 5

Enterprise Systems Computing in the Cloud


Internet-based computing where shared resources, software, and information are provided
to firms on demand
Emerged as a potential alternative to host enterprise systems and other firm computing
needs
Easily host enterprise system applications
Consider:
• Ensuring that any sensitive data is secure and backed up frequently by the host.
• Making sure the host has minimal down time and adequate processing speed.
• Requiring to have constant internet connection.

© McGraw Hill
End of Chapter 4

You might also like