Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

Relational

Databases
Fundamentals
✓Database Design Process
✓Required Readings from
Students
✓Database Design Process
Fundamentals
of Database ✓Data Modeling
Programming ✓Entity-Relationship Modeling
✓Data Normalization
Relational Database Design Process

Planning

Maintenance Analysis

Database Design
Process
Conceptual
Implementation Design

Logical
Physical
Design
Design
Relational Database Design Process
• What is Data Model?
✓ An abstract model that documents and organize the
business data for communications between team members
✓ A diagram that describes the most important things in your
business environment
✓ Is used as a plan for developing applications
Relational Database Design Process
• What is Entity-Relationship Model?
✓ An abstract and conceptual representation of data used in
relational database
✓ Diagram created by this process are called entity-
relationship diagrams (E-R Diagrams)
✓ Derived from user requirements
✓ Proposed by Peter Chen in 1976
Relational Database Design Process
• ERD Example
✓ User Requirements
✓ A company X receive products from suppliers that it supply
to its different departments
✓ Different suppliers can supply different products to
different department
✓ Company X wants a database driven application that can
implement the above requirements
Relational Database Design Process
• E-R Diagram – Step 1: Identify entities from
the requirements
✓ Entities are “things” in the business about which we want
to store data:

Product Department Supplier


Relational Database Design Process
• E-R Diagram – Step 2: Identify entities
attributes
✓ Properties of entities – allow entities to be described in real
terms
Name Product ID Category
Product
Relational Database Design Process
• E-R Diagram – Step 2: Identify entities
attributes
✓ Properties of entities – allow entities to be described in real
terms
Name Region ID
Department
Relational Database Design Process
• E-R Diagram – Step 2: Identify entities
attributes
✓ Properties of entities – allow entities to be described in real
terms
Name Address ID
Supplier
Relational Database Design Process
• E-R Diagram – Attribute Types
✓ Key Attribute – Primary key

Name Address DoB

Customer ID
Relational Database Design Process
• E-R Diagram – Attribute Types
✓ Derived Attribute
First

Name Address DoB

Customer ID
Relational Database Design Process
• E-R Diagram – Attribute Types
✓ Multivalued Attribute
Last First Age

Name Address DoB

Customer ID
Relational Database Design Process
• E-R Diagram – Step 3: Relationship Types
✓ One-to-One (1:1)
one instance of entity A is associated with instance of entity B
✓ One-to-Many (1:N)
For one instance of entity A, there are 0, one or many
instances of entity B
✓ Many-to-Many (M:N)
For one instance of entity A, there are 0, one or many
instances of entity B and for one instance of entity B, there
are 0, one or many instances of entity A
Relational Database Design Process
• E-R Diagram – Step 3: Relationship Types
✓ One-to-One (1:1) - Example

Car 1 Engine 1

Car 2 Engine 2

Car 3 Engine 3

Car 4 Engine 4
Relational Database Design Process
• E-R Diagram – Step 3: Relationship Types
✓ One-to-Many (1:N) - Example

Product 1
Supplier 1
Product 2
Supplier 2
Product 3
Supplier 3
Product 4
Supplier 4
Product 4
Relational Database Design Process
• E-R Diagram – Step 3: Relationship Types
✓ Many-to-Many (M:N) - Example

Person1 Car 1

Person 2 Car 2

Person 3 Car 3

Person 4 Car 4
Relational Database Design Process
• E-R Diagram – Step 3: Relationship Types
✓ Many-to-Many (M:N) – Not recommended for good
database design
✓ Need to be resolved into two one-to-many
Relational Database Design Process
• E-R Diagram – Step 3: Relationship Types
✓ Resolving Many-to-Many (M:N): 2 x One-to-Many

Person1 Car 1
Ownership 1

Person 2 Ownership 2 Car 2

Person 3 Ownership 3
Car 3
Ownership 4
Person 4 Car 4
Relational Database Design Process
• E-R Diagram – Relationships Symbols & Terms
• Mandatory, Many-to-Many

INSTRUCTOR STUDENT
Relational Database Design Process
• E-R Diagram – Relationships Symbols & Terms
• Optional, Many-to-Many

DEPARTMENT STUDENT
Relational Database Design Process
• E-R Diagram – Relationships Symbols & Terms
• Optional/Mandatory, Many-to-Many

INSTRUCTOR SKILL
Relational Database Design Process
• E-R Diagram – Relationships Symbols & Terms
• Optional/Mandatory, One-to-Many

PRODUCT VENDOR
Relational Database Design Process
• E-R Diagram – Relationships Symbols & Terms
• Mandatory, One-to-One

AUTOMOBILE ENGINE
Relational Database Design Process
• E-R Diagram – Relationships Symbols & Terms
• Recursive

EMPLOYEE is supervised by

supervise
END

END

You might also like