Processing math: 100%
Close
Close Window

Database

Chapter 2 The ER-Data Model and Mapping to Relational Schema

Show Source |    | About   «  2.5. ERD Relationship Types   ::   Contents   ::   2.7. Comprehensive example  »

2.6. Binary Vs Ternary Relationships

This section is devoted for:

This is achieved by: presenting two problem statements for two different stores’ policies of the same application domain.

The design solution of each problem should relate the same three entities. As the two stores have different working policies, so they have to use different ways to relate those entities so as to comply with the requirements of each store.

After presenting the problems, the reader will find that; the solution of the first problem (Store X) requires the use of a ternary relationship between the three entities, whereas the solution of the second problem (Store Y) requires the use of two binary relationships between the same three entities.

For each problem statement: (Store X & Store Y problems), all possible solutions that the designer may think of will be analysed starting with the wrong ones and finally presents the right solution. This aims to better understand the drawbacks of the wrong designs. And helps the reader to identify the circumstances in which a ternary relationship between three entities is required.

2.6.1. General Problem Statement

  • Both solutions require definning three entities (distributor, product, country).

  • The distributor entity is identified by distributor number and has name attribute.

  • Country is identified by country number and and has name attribute

  • Product is identified by product number and also has name attribute.

Tip: Before start watching the visualizations you should obey all step by step instructions given in the slides for better understanding.

General problem statement and Store X first solution illustration:

1 / 57 Settings
<<<>>>

Here are the problems' statments

Created with Raphaël 2.1.2
Store X: (global competition)
Store X has a lot of distributors to sell their several products around the world. The store's policy states that each distributor is allowed to sell the store’s products in each country. And also multiple distributors are allowed to sell products in the same country. In this case each distributor can set different price for each product type.
Store Y: (exclusive distributor)
Store Y has a lot of distributors to sell their several products around the world. The store's policy states that each country has only one distributor who sells all the store’s products exclusively. A distributor is permitted to distribute in many countries. The price of each product is set differently for each country.
Proficient Saving... Error Saving
Server Error
Resubmit

2.6.2. Ternary Relationship Example (Store X)

Store X second solution illustration:

1 / 23 Settings
<<<>>>

Here are the problems' statments

Created with Raphaël 2.1.2
Store X Second Solution Analysis
Two Binary relaionships, (distributor/country) & (distributor/product) including price relationships
NOTE: only Store X dataset records that reveal solution bugs will be examined for time saving
Proficient Saving... Error Saving
Server Error
Resubmit

Store X third solution illustration:

1 / 22 Settings
<<<>>>

Here are the problems' statments

Created with Raphaël 2.1.2
Store X Third Solution Analysis
Three Binary relationships, (distributor/country) , (distributor/product) & (country/product) including price relationships
NOTE: only Store X dataset records that reveal solution bugs will be examined for time saving
Proficient Saving... Error Saving
Server Error
Resubmit

Store X forth solution illustration:

1 / 17 Settings
<<<>>>

Here are the problems' statments

Created with Raphaël 2.1.2
Store X Forth Solution Analysis
One Ternary relationship, (distributor/country/product) including price as a relationship attribute
NOTE: only Store X dataset records that may reveal solution bugs will be examined to cover all possible test cases.
Proficient Saving... Error Saving
Server Error
Resubmit

2.6.3. Binary Relationship Example (Store Y)

Store Y first & second solutions’ analysis:

1 / 17 Settings
<<<>>>

Created with Raphaël 2.1.2
Store Y First & Second Solution Analysis
First sol.:One (N:M:P) Ternary relationship, between (country/distributor/product) including price as a relationship attribute
Second sol.:One (1:N:M) Ternary relationship, between (country/distributor/product) including price as a relationship attribute
Note: The difference between these two solutions is the '1' cardinality connecting country to the ternary relationship.
NOTE: The problem with Store Y proposed solutions is not that they hinder dataset Y records representation but they don't prevent faulty data as shown here in the visualization
Proficient Saving... Error Saving
Server Error
Resubmit

Store Y third & forth solutions’ analysis:

1 / 24 Settings
<<<>>>

Here are the problems' statments

Created with Raphaël 2.1.2
Store Y Third & Forth Solutions Analysis
- Three Binary relationships, 1:M (distributor/country) , N:M (distributor/product) & N:M (country/product) including price relationships
- Two Binary relationships, 1:M (distributor/country) & N:M (country/product) including price relationships
NOTE: only Store Y dataset records that reveal solution bugs will be examined for time saving
Proficient Saving... Error Saving
Server Error
Resubmit

   «  2.5. ERD Relationship Types   ::   Contents   ::   2.7. Comprehensive example  »

nsf
Close Window