Download Chapter 3 Effects of IT on Strategy and Competition

Document related concepts

Extensible Storage Engine wikipedia, lookup

Microsoft Jet Database Engine wikipedia, lookup

Open Database Connectivity wikipedia, lookup

Entity–attribute–value model wikipedia, lookup

Concurrency control wikipedia, lookup

Database wikipedia, lookup

Clusterpoint wikipedia, lookup

Relational model wikipedia, lookup

ContactPoint wikipedia, lookup

Database model wikipedia, lookup

Transcript
Chapter 5
Database Processing
Jason C. H. Chen, Ph.D.
Professor of MIS
School of Business Administration
Gonzaga University
Spokane, WA 99258
[email protected]
Dr. Chen, Management Information Systems
“We Don’t Have a Way to Track the
Data About the Videos.”
• Falcon Security stores sequentially numbered
digital video files in separated directories for
each client.
• Tracking down exact footage of when
equipment stolen means searching hundreds
of video files.
• Need database to track video files.
• MongoDB for tracking video files?
Dr. Chen, Management Information Systems
Study Questions
Q1: What is the purpose of a database?
Q2: What is a database?
Q3: What is a database management system (DBMS)?
Q4: How do database applications make databases more
useful?
Q5: How are data models used for database development?
Q6: How is a data model transformed into a database design?
Q7: How can Falcon Security benefit from a database
system?
Q8: 2026?
Dr. Chen, Management Information Systems
What is the most important
computer resource on the Internet
Search Engine (backend)?
Database
Answer: _________
Dr. Chen, Management Information Systems
Data, Data, and more Data
• Based on a true story
• What do we do with data?
– Keep records of events, activities, and
performance
– Find “wisdom/intelligence” from a high volume
Big Data)
of data (_____
– Expanding our understanding of the
environment
Dr. Chen, Management Information Systems
• You shall learn the following:
– 1) Database Concepts and
– 2) Conceptual Design (Data Model)
Dr. Chen, Management Information Systems
QUESTION
• Is MS/ACCESS (Oracle,
MS/SQL Server or IBM
DB2) a database?
Dr. Chen, Management Information Systems
Application
#1
Application
#2
Application
#3
Dr. Chen, Management Information Systems
???
Database
containing
centralized
shared data
Database Management System
Application
#1
Application
#2
Application
#3
Dr. Chen, Management Information Systems
DBMS
DBMS manages data
resources like an operating
system manages hardware
resources
Database
containing
centralized
shared data
Q1: What Is the Purpose of a Database?
• As a database user, you play a crucial role
(user’s inputs) in developing database
applications for your business or organization.
• Organize and keep track of things
• Keep track of multiple themes
• General rule:
 Single theme - store in a spreadsheet
 Multiple themes - use a database
But, need to NORMALIZE the database
– What's a theme?
• Ex: Student Grades or Faculty Data
Dr. Chen, Management Information Systems
10
A List of Student Grades Presented in a Spreadsheet –
Single Theme (Grades Only)
Fig 5-1 List of Student Grades, Presented in a Spreadsheet
Dr. Chen, Management Information Systems
Student Data Form from a Database – Multiple Themes
Fig 5-2 Student Data Shown in a Form from a Database
Dr. Chen, Management Information Systems
12
Q2: What is a database?
• These are terms you’ll need to
know when working with
databases.
– A database is an organized
collection of logically related
data files. (different from the text)
– Bytes, characters of data, are
grouped into columns which are
also called fields.
– The fields are grouped into rows
which are also called records.
– A table is a group of similar rows
or records which is also called a
file.
Dr. Chen, Management Information Systems
Fig 5-3 Student Table (also called a file)
5-13
Database
• Database: (text definition)
 A self-describing collection of integrated
records
 In databases, bytes are grouped into columns,
such as Student Number and Student Name.
fields Columns or
 Columns are also called ______.
fields, in turn, are grouped into rows, which are
records
also called _______.
Dr. Chen, Management Information Systems
14
Hierarchy of Data Elements

This figure shows the hierarchy of data elements working from the
smallest at the bottom to the largest at the top.
Fig 5-4 Hierarchy of Data Elements
Dr. Chen, Management Information Systems
A group of similar rows or records is
known as ________.
A) a prototype
B) a file (or table)
C) a field
D) an attribute
B
Answer: ______
Dr. Chen, Management Information Systems
16
Components of a Database:
Metadata Describes Structure of Database

A database is more than just a group of tables. It
includes tables or files plus the relationships among
rows in the tables and metadata that describes the
database’s structure.
Dr. Chen, Management Information Systems
Fig 5-5 Components of a Database
What Are Relationships Among Rows?



This diagram shows
relationships among pk
rows of different
tables.
The Student Number
(foreign key, fk) value
in the first row of the
top table,1325, relates
to the same Student
Number (primary key,
pk) value in a row in
the second table.
Both that Student
Number value and that pk
of 4867 in the second
table relate to those in
the third.
Dr. Chen, Management Information Systems
fk
pk
fk
Fig. 5-6: Example of Relationships Among Rows
Albert creates a relational database to store
employee performance statistics. He stores each
employee's data in independent rows and creates a
column named "Employee Number" to assign
unique numbers to each employee. This column is
referred to as a(n) ________.
A) primary key
B) key attribute
C) foreign key
D) functionally dependent record
A
Answer: _____
Dr. Chen, Management Information Systems
19
Relationship Special Terms
• Primary Key (pk)
 A column or group of columns that pk
identifies a unique row in a table.
 Student Number is the (primary) key
of the Student table. Given a value of
Student Number, you can determine
one and only one row in Student. Only
one student has the number 1325.
 Every table must have a (primary) key.
 Sometimes more than one column is
needed to form a unique identifier. In a
table called City, for example, the key
would consist of combination of
columns (City, State).
 Email_Num is the key of Email Table.
pk
 VisitID is the key of Office_Visit
Table.
Dr. Chen, Management Information Systems
fk
pk
fk
Relationship Special Terms
• Foreign keys (fk)
fk
pk
– These are keys of a different
(foreign) table than the table
in which they reside.
– A relational database carries
data in the form of tables and
uses foreign keys to represent
relationships
pk
• Relational databases
 Relationships among tables
are created by using foreign
keys.
• Relation
 Formal name for a table
Dr. Chen, Management Information Systems
pk
fk
For each field (attribute), what are the THREE most
information should be provided:
NAME
1. Field ___________
TYPE
(e.g., character or number etc.)
2. Field ___________
SIZE
3. Field ___________
Dr. Chen, Management Information Systems
22
Sample Metadata (in Access)



describe data and makes databases
Metadata are data that ________
easy to use. Metadata is always a part of a database.
The Field Name, Data Type, and Description at the top of this
diagram are part of the database’s metadata.
The additional
field properties
at the bottom
are also
considered
metadata.
Dr. Chen, Management Information Systems
Fig 5-7 Sample Metadata (in Access)
5-23
Q3: What Is a Database Management
System (DBMS)?
• Database developers use the DBMS to create or modify
tables, relationships, and other structures in a database.
• A DBMS (database management system) is a software
program used to create, process, and administer a database.
• Popular DBMS products include:
•
•
•
•
•
Oracle from Oracle Corporation (World #1 Database company)
DB2 from IBM
Access from Microsoft (for personal computers)
SQL Server from Microsoft (for large computer systems)
MySQL, was an open-source product, now acquired by Oracle
• Don’t confuse a DBMS, which is a software program, with a
_________,
database which is a collection of tables, relationships and
metadata. But, they are two different concepts.
Dr. Chen, Management Information Systems
Processing the Database
• Five DBMS operations
 Create
 Read,
 Insert,
 Modify,
 Delete data
• Applications call DBMS in different ways
 From a form, when the user enters new or changed data, a
computer program behind the form calls the DBMS to
make the necessary database changes.
 From an application program, the program calls the
DBMS directly to make the change.
Dr. Chen, Management Information Systems
Processing the Database
• Structured Query Language - SQL (seequell)
– International standard
– Used by most popular DBMS
INSERT INTO Student
([Student Number], [Student Name], HW1,
HW2, MidTerm)
VALUES (1000, ‘Franklin, Benjamin’, 90, 95,
100);
Dr. Chen, Management Information Systems
Adding a New Column to a Table (in Access 2013)
• Database developers use the DBMS to create and modify tables,
relationships, and other structures in the database.
• Below, the developer has added a new column called Response?.
This new column has data type Yes/No.
Fig 5-8 Adding a New Column to a Table (in Access)
Dr. Chen, Management Information Systems
Administering the Database
• Set up security system involving user
accounts, passwords, permissions, and
limits for processing
• Limit user permissions in very specific
ways
• Backing up database data, adding
structures to improve performance of
database applications, removing unwanted
data
Dr. Chen, Management Information Systems
Summary of Database Administration Tasks
Fig 5-9 Summary of Database Administration (DBA) Tasks
Dr. Chen, Management Information Systems
Summary of Database Administration Tasks
(cont'd)
Fig 5-9 Summary of Database Administration (DBA) Tasks
Dr. Chen, Management Information Systems
Browser-based applications ________.
A) need to be preinstalled on the users'
computers
B) run within a corporate network that is
protected from the Internet
C) eliminate the need to check for data
consistency
D) are more vulnerable to security threats
than are traditional applications
D
Answer: _____
Dr. Chen, Management Information Systems
31
Q4: How Do Database Applications Make
Databases More Useful?
Forms
Queries
__________
View data; insert new, update
existing, and delete existing data.
Search based upon data values
provided by the user.
Reports
Structured presentation of data using
sorting, grouping, Filtering, and other
operations.
Application
programs
Provide security, data consistency,
and special purpose processing,
e.g., handle
out-of-stock situations.
Dr. Chen, Management Information Systems
• Applications make database data more accessible and useful.
• Users employ a database application that consists of forms, formatted
reports, queries, and application programs.
• Database management system (DBMS) processes database tables for
applications.
Figure 5-10: Components of a Database Application System
Dr. Chen, Management Information Systems
Brenda, the sales manager of a firm, wants to
generate a particular report containing sales
analyses of the second and third quarter of the
year. She should use a ________ to obtain the
information that she wants from the database.
A) report
B) data model
C) database administrative function
D) Query
D
Answer: _____
Dr. Chen, Management Information Systems
Browser Forms, Reports, Queries, and Applications
• Database application programs process logic specific to a given business
need. For example, a program could track backordered items and hold a
customer order until the items are ready to ship.
• Application programs enable database processing over the Internet as the
figure below shows. Users access the applications programs on a Web server,
which in turn accesses a single DBMS and database.
Dr. Chen, Management Information Systems
Fig 5-13 Four Application Programs on a Web Server Computer
Example of a Student Report
• Data entry forms are used to read, insert, modify, and
delete data.
• Reports are used to show data in a structured context
as the example to the right shows.
Fig 5-11 Example of a Student Report
Dr. Chen, Management Information Systems
What Are Forms, Reports, and Queries?

A query form helps the
Sample
user
quickly find
query form
answers
to questions. In
used
this
case, the words
to enter
“barriers
phrase forto entry” were
found
searchin Baker’s record.
Sample query results of query operation
Fig 5-12 (a) & (b) Sample Query and Results
Dr. Chen, Management Information Systems
Browser Forms, Reports, Queries, and Applications
• Database application programs process logic specific to a given business need.
For example, a program could track backordered items and hold a customer
order until the items are ready to ship.
• Application programs enable database processing over the Internet as the
figure below shows. Users access the applications programs on a Web server,
which in turn accesses a single DBMS and database.
Dr. Chen, Management Information Systems
Fig 5-13 Four Application Programs on a Web Server Computer
Account Creation Browser Form
Fig 5-14 Account Creation Browser Form
Dr. Chen, Management Information Systems
Browser
Report
Fig 5-15 Browser Report
Dr. Chen, Management Information Systems
Access: A DBMS and an Application
Development Product
• Here’s a comparison of an Enterprise DBMS versus a
Personal DBMS.

Enterprise DBMS






Large organizational and
workgroup databases
Hundred to thousands of
users
Many different database
applications
24/7 operations
Oracle, DB2, SQL Server
Dr. Chen, Management Information Systems
Personal DBMS




Smaller, simpler applications
Personal or small workgroup
applications
1 - 100 users
Microsoft Access is both a
DBMS and application
development product as this
figure depicts.
Fig 5-Extra Personal Database System
PART II
Dr. Chen, Management Information Systems
Q5: How to Design a Database?
• Questions to ask (yourself or clients):
– What tables to create? (e.g., GU database)
– What attributes (fields) should be in each table?
– How those tables (and how many) are related to
each other?
• Data model: is a conceptual representation of
data classes (data files) and their relationships.
• Relational database: data are organized as twodimensional tables called relations, which are
linked together by sharing the same field.
Dr. Chen, Management Information Systems
Q5: How Are Data Models Used for Database
Development?
A data model is similar to blueprints for a house. It’s a
logical representation of database data that describes
data and their relationships
______
____________.
Fig 5-17 Database Development Process
Dr. Chen, Management Information Systems
________ is the process of converting a
data model into tables, relationships, and
data constraints.
A) Database design
B) Database querying
C) Data mining
D) Database aggregation
A
Answer: ______
Dr. Chen, Management Information Systems
45
Steps of Database Development
…
User view-1
User view-2
User view-3
…
User view-N
…
User interview &
Integrated Model
Conceptual Schema (Model)
Logical Model
(ERD or E/ERD)
Data
Model
Implementation
(w/Physical or Internal Model)
Dr. Chen, Management Information Systems
46
How are data models used for
database development?
• Conceptual Design
– The process of preparing an abstract model of the database from
business perspective, which describes the information needs of
end users of the database
– Entity-relationship approach => E-R Diagram (ERD)
– Relational DBMS:
• Transform ERD to tables
• Normalization process (you will learn it later)
• Physical Design
– Describe how data would be physically stored in the data storage
– Depends on the DBMS
Dr. Chen, Management Information Systems
How are data models used for database
development?
• An entity-relationship (ER) data model helps developers
define things (entities) that will be stored in the database as
they are building a data model.
• It also defines relationships among those entities.
• Entities are things users want to track. It can be a physical
object (inventory items) or a logical transaction (sales order).
The names are always singular.
• Each entity has attributes that describe its characteristics. The
entity “Order” has attributes like “OrderNumber” and
“OrderDate”.
• An identifier (pk) is an attribute whose value is associated
with one and only one entity instance. “OrderNumber” is the
identifier for the “Order” entity because there should only be
one number for each order. (see next slide)
Dr. Chen, Management Information Systems
Components of the Entity-Relationship Data Model
Entities /
Table/ Files
• Something users want to track
• Order, customer, salesperson, item,
volunteer, donation
Attributes /
Fields
• Describe characteristics of an entity
• OrderNumber, CustomerNumber,
VolunteerName, PhoneNumber
Identifier /
Primary Key
(PK)
Dr. Chen, Management Information Systems
• Uniquely identifies one entity instance
from other instances
• Student_ID_Number
49
________ is the process of converting a
data model into tables, relationships, and
data constraints.
A) Database design
B) Database querying
C) Data mining
D) Database aggregation
A
Answer: ______
Dr. Chen, Management Information Systems
50
A Data Model on Customer and Order
Segment of an Enterprise Data Model
CUSTOMER
ORDER
M ORDER?
Q1. One CUSTOMER normally places ___
1 CUSTOMER?
Q2. One ORDER normally is placed by __
How about the relationship between ORDER and PRODUCT?
(see next slide)
Dr. Chen, Management Information Systems
ORDER
ORDER_NUMBER (pk)
Customer_ID
Order_Date
Q3. One PRODUCT normally is
contained in M
__ ORDER?
Q4. One ORDER normally contains
__ PRODUCT?
M
Dr. Chen, Management Information Systems
ORDER
ORDER_NUMBER (pk)
Customer_ID
Order_Date
Q3. One PRODUCT normally is
contained in M
__ ORDER?
Q4. One ORDER normally contains
__ PRODUCT?
M
Dr. Chen, Management Information Systems
Comparison of enterprise and project level data models
(a) Segment of an Enterprise Data Model
Q: what are two major differences
between (a) & (b)?
(b) Segment of a Project-Level Data Model
Product_ID
Order_ID
Dr. Chen, Management Information Systems
How are data models used for database
development?
• User involvement is critical for database
development for these reasons:
– A database’s design depends on how users view
their business environment and how they do their
jobs.
– Database developers do not and cannot know what
to include because they don’t work with the data
everyday. They must rely on users to tell them
what data are important and how they’re used..
Dr. Chen, Management Information Systems
5-55
What Is the Entity-Relationship Data Model?
• Entity-relationship (E-R) data model
A tool for constructing data models
Developers use it to describe the content of a
data model by defining entities that will be
stored in database and relationships among
those entities
Unified Modeling Language (UML), less
popular, tool for data modeling
Dr. Chen, Management Information Systems
Entities
• Some thing that the users want to track
• Examples of entities:
 Order, Customer, Salesperson, and Item. Some entities represent a
physical object, such as Item or Salesperson; others represent a
logical construct or transaction, such as Order or Contract.
 Entity names are always singular.
• Attributes
 Describe characteristics of an entity.
 Examples: order attributes are OrderNumber, OrderDate, SubTotal,
Tax, Total, and so forth.
• Identifier
 An attribute (or group of attributes) whose value is associated with
one and only one entity instance.
Dr. Chen, Management Information Systems
Student Data Model Entities
Student, Department, Advisor, Email, and Office_Visit are the
entity names in this model.
The entity identifiers are StudentNumber, DeptName, and
AdvisorName. Not all entities require an identifier.


pk
pk
pk?
pk
Dr. Chen, Management Information Systems
pk?
Fig 5-18 Student Data Model Entities
Example of Department, Adviser, and Student
Entities and Relationships (cont'd)
• Relationships join one
entity to another entity
– One-to-one – 1:1
– One-to-many – 1:N
– Many-to-many – N:M
• This diagram shows that
each Department Entity
can have multiple
Adviser Entities in a oneto-many relationship.
Adviser Entities can
have a many-to-many
relationship with Student
Entities.
Dr. Chen, Management Information Systems
M:N or
N:M
1:N
School of
Business?
Fig 5-19 Example of Department, Adviser, and
Student Entities and Relationships
59
Basic E-R notation
Entity
symbols
A special
entity that is
also a
relationship
Attribute
symbols
Relationship
symbols
Relationship
degrees
specify
number of
entity types
involved
Dr. Chen, Management Information Systems
Relationship
cardinalities
specify how
many of each
entity type is
allowed
Sample of Relationships
(Adviser and Student) -Version 1
Crow’s
Feet
1:N
One department
may have many
advisers, but an
adviser may be
in only one
department
N:M
An Adviser may
have many
students, and
one student
may have many
advisers
e.g.,
Students
have
multiple
majors from
multiple
schools
Fig 5-20 Sample of Relationships Version 1
Dr. Chen, Management Information Systems
61
Sample of Relationships
(Adviser and Student) - Version 2
“Crow’s
Foot”
N:M
A department has
many advisors,
and an advisor
may advise for
more than one
department
1:N
A student has
only one
advisor, but an
adviser may
advise many
students
Fig 5-21 Sample of Relationships Version 1
Dr. Chen, Management Information Systems
62
Crow’s-Foot Diagram Version




Maximum cardinality represents the maximum number of entities
that can be involved in a relationship.
Minimum cardinality represents the minimum number of entities that
can be involved in a relationship.
The vertical bar below indicates that at least one (mandatory) entity
is required between Department and Adviser and between Adviser
and Student.
The oval below indicates that an entity is optional and doesn’t
require a relationship.
mandatory
optional
Fig 5-22 Sample Relationships Showing Maximum/Minimum Cardinality
Dr. Chen, Management Information Systems
5-63
A student management system allows students
to have multiple majors, and advisers are
assigned to handle multiple students and
courses. This is an example of a(n) ________
relationship.
A) 1:N
B) 1:1
C) N:M
D) M:1
C
Answer: _____
Dr. Chen, Management Information Systems
Q6: How Is a Data Model Transformed
into a Database Design?
Normalization
• _____________
• Converting poorly structured tables into two or
more well-structured tables
• Goal
• Construct tables with data about a single theme
or entity
• Purpose
• To minimize data integrity problems
Dr. Chen, Management Information Systems
Data Integrity Problems
• Data integrity problems
• Produce incorrect and inconsistent
information
• Users lose confidence in information
• System gets a poor reputation
• Can only occur if data are duplicated
(or un-normalized)
Dr. Chen, Management Information Systems
Poorly Designed Employee Table Causes Data
Integrity Problem



Converting a poorly structured table into two or more well-structured
tables is called normalization (Normalization
The table below is poorly designed because it includes the
DeptName (i.e., two themes) as part of the Employee record,
making it difficult to update.
It also creates data integrity
problems because
the DeptName is not
consistent throughout
the table after the
data were updated.
Question: What happen if
“Smith” is laid off and the
record is deleted?
Dr. Chen, Management Information Systems
Fig 5-23: Poorly Designed Employee Table
Steps of Database Development
User view-1
User view-2
User view-3
…
Conceptual Schema (Model)
Logical Model
(ERD or E/ERD)
???
Implementation
(w/Physical Model)
Dr. Chen, Management Information Systems
…
…
User view-N
Steps of Database Development
User view-1
User view-2
User view-3
…
…
User view-N
…
Conceptual Schema (Model)
Logical Model
(ERD or E/ERD)
Normalization
_____________ (up to 3NF)
_____________
Implementation
(w/Physical Model)
Dr. Chen, Management Information Systems
(more tables
created)
Data Integrity Problems
• In the right figure, some rows show
Dept. 100 is “Accounting and
Finance” and others show Dept. 100
is “Accounting.” Which one is
correct?
• A table with data integrity
problems will produce incorrect
results and inconsistent information.
• Data integrity problems happen
when data are duplicated.
• Users will lose confidence in the
information, and system will
develop a poor reputation.
Information systems with poor
reputations become serious burdens
to the organizations that use them.
Fig 5-23 A Poorly Designed Employee Table
Dr. Chen, Management Information Systems
Normalizing for Data Integrity
• Normalized tables eliminate (at least
minimize) data duplication, but they can be
slower to process.
• General goal of normalization is to
construct tables such that every table has a
single topic or theme.
______
Dr. Chen, Management Information Systems
71
Normalizing for Data Integrity
• Normalizing the tables by
splitting the Department data into
a separate table, as shown below,
allows each table to describe a
single topic or theme. The tables
have been transformed into a
normal form.
• By eliminating the duplicate data,
you eliminate (solve)
data integrity problems.
That’s called normalizing
for data integrity..
Now, the department name
only needs to be updated in one
place in the normalized tables
Dr. Chen, Management Information Systems
Fig 5-24: Two
Normalized Tables
Question: What happen if “Smith” is laid off
or resigned and the record is deleted now?
Why it is in a better status?
72
Two Normalized Tables
A table is with two themes (before Normalization)
After Normalization
Single
Theme in
Each Table
Two tables are produced (each
table is with single theme)
after Normalization.
Dr. Chen, Management Information Systems
Two Normalized Tables
A table is with two themes (before Normalization)
After Normalization
Single Theme
in Each Table
(two tables
total)
Two tables are produced (each
table is with single theme)
after Normalization.
Dr. Chen, Management Information Systems
The process of normalization constructs
tables such that every table has a ________.
A) one-to-one relationship between entities
B) single theme
C) foreign key
D) specialized graphical query
B
Answer: _____
Dr. Chen, Management Information Systems
Summary of Normalization:
Representing Relationships
• This chart shows the necessary steps to transform a
data model into a relational database design.
(1)
(pk)
You will learn more (2)
(HOW?) in bmis441 if
(3)
you are interested in
MIS concentration
(for data integrity)
(fk)
Fig 5-25 Transforming a Data Model into a Database Design
Dr. Chen, Management Information Systems
76
Summary of Normalization
• Database practitioners classify tables into various
normal forms according to the kinds of problems
they have.
• Transforming a table into a normal form to remove
duplicated data and other problems is called
normalizing the table.
• Normalization is just one criterion for evaluating
database designs. Normalized designs can be slower
to process, database designers sometimes choose to
accept non-normalized tables. The best design
depends on the users’ processing requirements.
Dr. Chen, Management Information Systems
Steps for Transforming Data
Model Into a Database Design
1. Construct Adviser table and Student
tables with key fields
2. Represent relationships by adding
foreign keys (fk)
3. Create new table for N:M relationships
(only if the relationship is N:M)
Dr. Chen, Management Information Systems
Representing 1:N Relationships
What is the
difference between
(b) & (c)?
pk
pk
pk
pk
Fig 5-26 Representing a 1:N Relationship
Dr. Chen, Management Information Systems
fk
Transforming Data Model Into a Database Design –
Step 1: Construct Tables with Key fields ‘pk’

pk
The figure on the left represents the relationship (1:N) between
tables. The figure on the right shows a normalized table for
each entity.
pk
pk
pk
1. However, we should know that AdvserName
is not a good pk as it may not be “unique”.
2. What should be a good one?
Ans: Adviser_ID
Figure 5-26 (a&b) Representing a 1:N Relationship
Dr. Chen, Management Information Systems
Transforming Data Model Into a Database Design Step 2: Adding fk
pk
pk
fk
From Figure 5-26 (c) Representing a 1:N Relationship
Dr. Chen, Management Information Systems
Fig 5-26:
Representing a 1:N
Relationship (in
normalized form)
pk
Step 1.
pk
Transforming a
Data Model into a
Database Design:
1:N Relationship
pk
pk
fk
Step 2.
Represent relationships by
adding foreign keys (fk)
Dr. Chen, Management Information Systems
82
82
Example 2
M to N
Dr. Chen, Management Information Systems
How to solve the M:N problem?
Adviser
pk
AdviserName
Email
Student
pk
StudentNumber
StudentName
MidTerm
cpk (composite key)
Adviser
AdviserName
Email
Student
Adviser_Student
AdviserName
StudentNumber
StudentNumber
StudentName
MidTerm
(Intersection/Associative
Entity)
What is the pk in the new Table (Adviser_Student)?
Ans: AdviserName and StudentNumber together (cpk – composite
key)
General Rule: One M:N relationship will be broken down into Two 1:M relationships.
Dr. Chen, Management Information Systems
How to solve the M:N problem?
[1] pk
pk
cpk (composite key)
[2]
fk
fk
pk
Finally, three tables are produced for the normalized form.
Therefore, two tables originally in the data model and three
tables are produced after the normalization.
Dr. Chen, Management Information Systems
[3]
Transforming Data Model Into a Database Design Step 3: Create new table for N:M relationships
The previous
relationship
is 1:N,
therefore, it
does not
need to
create a new
table
pk
pk
Since it is not in
Third Normal
Form (3NF).
How?
Figure 5-27 (a&b) Incorrect Representation of N:M Relationship
Dr. Chen, Management Information Systems
Representing an N:M Relationship:
Strategy for Foreign Keys
pk
pk
cpk (composite key)
One M:N relationship will be broken down into _____
Two 1:M relationships.
General Rule: ____
Dr. Chen, Management Information Systems
87
pk
pk
fk
Steps
1&2.
pk
fk
Step 3.
fk
Dr. Chen, Management Information Systems
Fig 5-27: Representing an N:M Relationship
88
pk
pk
fk
pk
Steps
1&2.
pk
cpk
fk
Step 3.
fk
Dr. Chen, Management Information Systems
Fig 5-27: Representing an N:M Relationship
89
How to solve the M:N problem?
The Final Status
pk
pk
cpk (composite key)
fk
What is the pk for
Adviser_Student_Int
ersection table?
Dr. Chen, Management Information Systems
fk
Users’ Role in the Development of
Databases
• Final judges.
• Thorough review of data model.
• Entities must contain all the data users need
to do their jobs.
• Must accurately reflect their view of the
business.
• Take it seriously.
• Devote time.
Dr. Chen, Management Information Systems
Q7: How Can Falcon Security Benefit
from a Database System?
• Find videos by querying their characteristics.
• “Which videos do we have of the Beresford
Building in October 2014, shot from 3,000 feet
or less?”
• Choices
1. Store videos on a file server and keep metadata
about each video in a relational database to query
with SQL.
2. Use NoSQL MongoDB.
Dr. Chen, Management Information Systems
Q8: 2026?
• Volume of database continues to grow.
• Cheap, unlimited storage, greater processing speeds
do in relational databases.
• Security becomes more important.
• Many NoSQL, NewSQL, and in-memory databases
exist in commerce.
• Keep abreast of developments.
• Watch from investor’s perspective.
• New opportunities and career paths will develop
around these new DBMS products.
• Separate yourself from the competition when it
comes to job interviews.
Dr. Chen, Management Information Systems
From Data to Knowledge:
How Can Organization Gain Competitive Advantage?
(Survive and Prosper in the Digital Economy)
Data
process
Information
Quality
Information
Available
-As a product
NOT byproduct
Decision
Making
Accessible
context,
experience
D. B.
Organizational
Knowledge
D.B.:
Structured: R-DBMS
Unstructured: Document Mgt. Systems
informate
Dr. Chen, Management Information Systems
Sharable
Collaborative
Reusable
K.B
D.W
automate
Useable
innovate
-As core intellectual capital
NOT merely a few smart employers
External
customers
CRM
Accounting
Finance
Operations
Manufacturing
Q8: 2026?
• Volume of database continues to grow.
• Cheap, unlimited storage, greater processing speeds
do in relational databases.
• Security becomes more important.
• Many NoSQL, NewSQL, and in-memory databases
exist in commerce.
• Keep abreast of developments.
• Watch from investor’s perspective.
• New opportunities and career paths will develop
around these new DBMS products.
• Separate yourself from the competition when it
comes to job interviews.
Dr. Chen, Management Information Systems
• END of CHAPTER 5
Dr. Chen, Management Information Systems