Professional Documents
Culture Documents
Relational Modelling
1
Course: Data Engineering - I
Edit Master
Lecture textManagement
On: Data styles and
Relational Modelling
Instructor: Vishwa Mohan
2
Session 5 | Use Case Example
Session Overview
Identifying any partial
functional dependency and
Understanding the attributes of a use
transitive dependencies.
case example
Attributes Attributes
Attributes Attributes
10 20Jan2020 South indian plot 5, 9768546320 South Indian Veg Plan Premium
Food mumbai
Virat 9765438210 plot 10, Plan premium idli, dosa 5, 2 South Indian, Veg, Veg
mumbai South Indian
Coupon Price Payment Delivery Employee Vehicle Pickup Time Delivered Total Delivery
Applied Paid Mode Name Number Time Time
Restaurant
Item
Restaurant ID
Item ID
Name
Restaurant ID
Item Type
City
Item Category
State
Customer and Item Entities
The relation between the customer and item tables is many-to-many.
To implement a many-to-many relation, there will be one more entity ‘order’ that has a
many-to-one relation with customer table as well as order table.
Customer Item
Customer ID
Item ID
Name
Restaurant ID
Phone Number
Item Name
Customer Address
Item Price
City
Item Description
State Item Type
Customer Membership
Item Category
Customer Membership Price
The Order Entity
Customer
Customer Id Order
Name Customer ID
Phone Number Coupon Applied
Customer Address Price Paid
City Total Delivery Time
State
Customer Membership
Order
Item
Customer ID
Item ID
Restaurant ID
Restaurant ID
Item ID
Item Name
Coupon Applied
Item Price
Price Paid
Item Description
Total Delivery Time
Item Type
Item Category
The Order Entity
Customer Item
Order
Customer ID
Item ID
Customer ID
Name
Restaurant ID
Restaurant ID
Phone Number
Item Name
Item ID
Customer Address
Item Price
Coupon Applied
City
Item Description
Price Paid
State
Item Type
Total Delivery Time
Customer
Membership Item Category
Customer
Membership Price
The Order Entity
Delivery Employee
Order
Restaurant ID
Name
Item ID
Vehicle Number
Delivery Employee ID
Price Paid
Membership Plan
Total Delivery Time
Membership Plan Details
Order
All Entities Item
Customer ID Item ID
Customer
Restaurant ID
Restaurant ID
Customer ID
Item ID Item Name
Name
Delivery Employee ID ...
Phone Number
Coupon Applied
Customer Address
Price Paid
...
Total Delivery Time
Name Name
... ...
Functional Dependencies
Order Order
There is no composite key in
Customer ID this table to uniquely identify Order ID
every record.
Restaurant ID Customer ID
Restaurant ID
Delivery Employee
ID
Order ID
Item ID
Coupon Applied
Price Paid
Functional Dependencies
Order
Order ID Order
Order Item
Customer ID Order ID
Order ID
Restaurant ID Customer ID
Item ID
Item ID Restaurant ID
Coupon Applied
Delivery Employee ID Delivery Employee ID
Price Paid
Coupon Applied Total Delivery Time
Price Paid
Item Price
Restaurant ID is the foreign key to
Item Description the restaurant table. Item Id and
Item Type
restaurant ID form the composite
key for the table. All the non-prime
Item Category attributes fully functionally
dependent on prime attributes.
Transitive Dependencies in Customer Entity
Customer
Phone Number
Customer Address
Customer ID -> City -> State
City
State
Customer Membership
Customer Membership ID
Customer
Customer Membership Price
Customer ID
City
Name
Zip Code
Phone Number
City Name
Customer Address
State ID
Zip Code
State ID
State Name
Transitive Dependencies in Restaurant Entity
Restaurant
Restaurant ID
Restaurant ID -> City -> State
Name
Type
Restaurant ID -> Type -> Type
Category Details
Restaurant ID -> Category ->
Address
Category Details
City
State
Transitive Dependencies in Restaurant Entity
Restaurant Restaurant Category
Restaurant ID Category ID
Category Name
Name
Category Description
Type ID
Category ID City
Zip Code
Address
City Name
Zip Code
State ID
Restaurant Type
State
Type ID
State ID
Type Name
State Name
Type Description
Transitive Dependencies in Delivery Employee Entity
Delivery Employee
Delivery Employee ID
Delivery Employee ID -> Membership Plan
-> Membership Details
Name
Vehicle Number
Date of Joining
Membership Plan
Delivery Employee
Date of Joining
Membership Plan ID
Transitive Dependencies in Item Entity
Item
Item ID
Restaurant ID
Item Name
Item Category
Transitive Dependencies in Item Entity
Item Category
Item Category ID
Item ID Category Name
Restaurant ID Category Description
Item Name
Item Type
Item Price
Type ID
Item Description
Type Name
Type ID
Type Description
Category ID
Transitive Dependencies in Order Entity
Order
Customer ID Order ID
Restaurant ID Item ID
Order Item
Delivery Item
Employee Item
Category