Designing a Relational Database - Part 1
Mark Fontenot, PhD
Northeastern University
What we’ve done so far…
Hypothetical #1
You’re hired for your next co-op and the project is to build a piece of software for internal use to help manage the companies many co-ops and interns (126 this year alone). The company needs to keep track of employee information, supervisor info, projects they’re working on, etc. as well as output from goal setting, check-ins, exit interviews, and surveys.
Ready… Set….. Go!
Wait… what do you do? 🤔
Hypothetical #2
You just got your first job as a data scientist and your first project is to work with a developer on updating their database model to support real-time monitoring and analytics of customer behavior for an upcoming dynamic pricing model the CEO wants to implement.
Ready… Set….. Go!
Wait… what do you do? 🤔
DATA MODELING
5
Some Review
6
Data Independence
7
Physical Model
Logical Model
User Interface
Physical Data Independence
Logical Data Independence
Basic Idea: We want to keep the storage independent from the usage of the data
Data Independence
8
Database Design Lifecycle
9
Requirements Analysis
Logical Model Design
Physical Model Design
Implementation/Maintenance
Requirements
10
Requirements Analysis
Logical Model Design
Physical Model Design
Implementation/
Maintenance
Abstraction in Database Design
External Schema 1
External Schema 2
External Schema 3
Conceptual Database Schema
Physical Database Schema
Disk
Logical Design
12
Requirements Analysis
Logical Model Design
Physical Model Design
Implementation/
Maintenance
Localized Data Models - Visual Example
Customers
Orders
Products
Sales Person
Products
Orders
Suppliers
Warehouse Worker
Products
Orders
Suppliers
Global
Customers
Logical Design
14
Requirements Analysis
Logical Model Design
Physical Model Design
Implementation/
Maintenance
Physical Design
15
Requirements Analysis
Logical Model Design
Physical Model Design
Implementation/
Maintenance
Physical Design
16
Requirements Analysis
Logical Model Design
Physical Model Design
Implementation/
Maintenance
Implementation/Maintenance
17
Requirements Analysis
Logical Model Design
Physical Model Design
Implementation/
Maintenance
ENTITY-RELATIONSHIP MODEL
18
Definitions (some review)
Definitions (some review)
Entities
21
Customer
Video
Rents
cust-id
cust-name
video-id
copy-no
title
due-date
N
N
Modified Chen Diagramming Technique
Attributes
22
Customer
Video
Rents
cust-id
cust-name
video-id
copy-no
title
due-date
N
N
Attributes - characteristics of the entities that provide detail about them.
Modified Chen Diagramming Technique
Relationships
23
Customer
Video
Rents
cust-id
cust-name
video-id
copy-no
title
due-date
N
N
Modified Chen Diagramming Technique
Multivalued Attributes
24
Customer
cust-id
cust-name
N
. . .
phone
Professor
idNum
name
N
. . .
degrees
Modified Chen Diagramming Technique
Composite Attributes
25
Customer
cust-id
cust-name
N
. . .
address
zip
city
street
state
Modified Chen Diagramming Technique
Relationship Degree
26
Employee
manages
N
1
manager
subordinate
Recursive
Department
is sub-unit
Division
Binary
Employee
uses
Project
Skill
Ternary
N
1
N
N
N
Modified Chen Diagramming Technique
Relationship Cardinality
27
Department
Employee
is managed by
1
1
Department
Employee
has
1
M
Employee
Project
works on
M
N
1:1
1:M
M:N
Modified Chen Diagramming Technique
Relationship Participation
28
Department
Employee
is managed by
1
1
Dependent
Employee
Dependent
has
Mandatory
Optional
Modified Chen Diagramming Technique