Professional Documents
Culture Documents
Jiye BAEK
Department of MIS
Korea University Business School
TODAY
Online Platform
Digital Economy
Business Analytics
Emerging Technologies
Online Platform
Digital Economy
Business Analytics
Emerging Technologies
Networking
IT
Hardware Software
Infrastructure
Data
management
8
IT Infrastructure
Networking
IT
Hardware Software
Infrastructure
Data
management
9
HAVE YOU EVER EXPERIENCED THIS?
10
HOW CAN AMAZON KEEP TRACK OF
SO MANY ORDERS, CUSTOMERS, AND PRODUCT?
11
12
DATABASE MANAGEMENT SYSTEMS (DBMS)
37
37
38
39
40
ENTITY RELATIONSHIP DIAGRAM
Entity and Attributes
Entity
Generalized category representing person, place, thing on which we
store and maintain information
E.g., Supplier, Part
Attributes
Specific characteristics of each entity
E.g., Supplier’s name, Supplier’s address, Part’s description, Part’s unit price
PK Customer_ID
PK Product_ID PK Order_ID
This common field must be the primary key for one of the tables
linked, and it is called a foreign key for the other table.
A foreign key has to be a primary key in another table
Customer table
Cust. ID Cust. Name Reward Program
… … …
Cust. ID is
Ø the primary key for
Transaction table the customer table
Trans. Trans. Store ID Cashier Cust. ID Prod. ID Ø the foreign key for
ID Time ID the transaction table
… … … … …
Customer_ID FK
Product_ID FK
Product_ID FK
▊ In
the ERD – cardinality is represented by using the “crows-foot”
notation
63
63
CARDINALITY
CARDINALITY RELATIONS VISUALIZED
64
64
CARDINALITY
CARDINALITY EXAMPLES
65
65
REPRESENTING CARDINALITIES IN ERD
(HOW SHOULD WE “READ” THESE EXAMPLES?)
Manages
Manager Department
A manager manages one and only one department, and a department is managed by
one and only one manager
Works at/Employed by
Employee Resort
An employee works at zero or one resort, and a resort employees one or more employees
Visits Resort
Customer
A customer visits one or more resorts, and each resort may have zero or more (zero, one or
many) customers.
66
66
BUSS215 © Jiye BAEK 67
ENTITY
▊ The
entity (or entity-class) represents a type of object with some
common characteristics:
‧ Persons: agency, contractor, customer, department, division, employee, instructor,
student, supplier
‧ Places: sales region, building, room, branch office, campus
‧ Objects: book, machine, part, product, raw material, software license, software package,
tool, vehicle model, vehicle
‧ Events: application, award, cancellation, class, flight, invoice, order, registration, renewal,
requisition, reservation, sale, trip
‧ Concepts: account, block of time, bond, course, fund, qualification, stock
▊ We can say that the entities are the “nouns” in our data model
▊ In
the ERD we represent each entity by a rectangle with the unique
name.
‧ Choose a simple name that makes business sense (Business rule)
‧ Entity names are Singular – E.g., “Student” not “Students”
68
68
EXAMPLE – ENTITIES IN A HOTEL ENVIRONMENT
69
69
RELATIONSHIPS
▊ In
the ERD – a relationship is often represented by a “straight line
connecting two entities.
70
70
EXAMPLE – RELATIONSHIP
es
Buys
rv
Se
Employee Product
71
71
A FULL DIAGRAM
Resort Visits
Customer
Offer ces
s Ser vi
Works At Buys
Employee Sells
Product
72
72
ATTRIBUTES (FIELDS)
73
73
Customer
Resort Customer ID#
Resort ID# Cust Name
Resort Name Cust Type
Address Line 1 Visits Cust Phone #
City Cust Arrival Date
State Cust Depart Date
Zip
Offers
r ves
se
Buys
Works
at
Employee Product
Employee ID# Product ID#
Employee Name Item
Salary Sells Unit Price
Position Name
74
74
Customer
Resort Customer ID#
Resort ID# Cust Name
Resort Name Cust Type
Address Line 1 Visits Cust Phone #
City Cust Arrival Date
State Cust Depart Date
?? ??
Zip Offers es
r v
se
Buys
Works at
?? ?? Product
Employee Sells
Employee ID# Product ID#
Employee Name Item
Salary Is Sold by Unit Price
Position Name
▊ The
ERD provides a convenient visual representation of the
conceptual/logical model
‧ A great communication tool between business managers and IT-personnel
▊ Together
with the diagram, it is important to provide some
documentation that describes:
‧ The entity, the relationships, and their attributes
‧ Justify the cardinalities
§ Especially, if any of the above is not obvious and “straight forward”
76
76
CONVERTING AN ERD TO DATABASE DESIGN
● If the ERD is the logical model, Database Design is the physical model
● Conversion
o Entities become tables
o Entity’s attributes become table columns
o Add Foreign Keys (create table columns for foreign keys)
o Create intermediary tables for many-to-many-relationships
77
CONVERTING AN ERD TO DATABASE DESIGN
STUDENT
Student ID
Last Name
First Name
Enrolls in/Contain
PROFESSOR
SECTION CLASSROOM
Professor ID
FirstName Taught by Section ID Is taught in Room ID
LastName Time Room Number
Email Room ID Room Capacity
Phone
78
CONVERTING AN ERD TO DATABASE DESIGN
ERD DB DESIGN
SECTION SECTION
SECTION
79
CONVERTING AN ERD TO DATABASE DESIGN
ERD DB DESIGN
Professor ID ProfessorID
ProfessorID FirstName LastName Email
FirstName FirstName
LastName LastName
Email Email
Phone Phone
SECTION SECTION
SECTION
Section ID
SectionID SectionID Time Room ID
Time
Time
Room ID
Room ID
80
CONVERTING AN ERD TO DATABASE DESIGN
PROFESSOR
ProfessorID PROFESSOR
FirstName
LastName ProfessorID FirstName LastName Email
Email
Phone 111 Kennen Kelley KKelley@bu.edu
SECTION
SECTION
81
ERD VS DATABASE
STUDENT SECTION
A student enrolls in one or more sections, and a section is enrolled by zero or more students
82
ERD VS DATABASE
83
ERD VS DATABASE
STUDENT Section
84
ERD VS DATABASE: THE INTERMEDIARY TABLE
U987349876 LA245
U987349876 SM221
U871237673 IS223
U871237673 LA245
85
ERD VS DATABASE
86
86
ERD VS DATABASE
87
87
ERD VS DATABASE: THE INTERMEDIARY TABLE
88
88
ERD VS DATABASE
STUDENT
Student ID
Last Name
First Name
Enrolls in/Contain
PROFESSOR
SECTION CLASSROOM
Professor ID
FirstName Taught by Section ID Is taught in Room ID
LastName Time Room Number
Email RoomID Room Capacity
Phone
89
ERD VS DATABASE: THE INTERMEDIARY TABLE
Intermediary table
90
ERD VS DATABASE: THE INTERMEDIARY TABLE
STUDENT ENROLL
1 ∞
Student ID Student ID
∞
Last Name Section ID
First Name Semester
91
Exercise: Fitness First Database Design
93
93
TAKE-AWAYS
▊ Effective
queries and reports require that the correct data model be in
place and instantiated in the database application.
94
94