Saturday, September 24, 2016

Hierarchies and Recursive Relationships

  • ·         A relationship between an entity and itself. –Recursive Relationship
  • ·         A series of relationships that reflect entities organized into successive levels. –Hierarchal relationship

1. Develop two ER diagrams to represent the following situation. Develop one using a hierarchical structure and one using a recursive structure.
“Our company sells products throughout the United States. So we’ve divided the U.S. into four major sales regions: the Northern, Eastern, Southern, and Western regions. Each sales region has a unique region code. Each sales region is then divided into sales districts. For example, the Western region is divided into the Rocky Mountain, Northwest, Pacific Coast, and Pacific districts. Each district has a unique district code. Each district is made up of sales territories. The Rocky Mountain district is composed of three territories: Wyoming-Montana, Colorado, and Utah-New Mexico. The North-west district is made up of two territories: the Washington and Oregon-Idaho territories. The Pacific Coast district is composed of two territories: the California and Nevada territories. The Pacific District includes the Hawaii territory and the Alaska territory. Each territory has a unique territory code.
Then each sales territory is broken down into sales areas. For example, Colorado is made up of two sales areas: the Front Range and the Western Slope sales areas. Each sales area has a unique sales-area code.
Each salesperson is responsible for one or more sales areas and has a specific sales quota. We also have sales managers who are responsible for one or more sales districts and sales directors who are responsible for one or more sales regions. Each sales manager is responsible for the territories with his/her districts. We don’t overlap our employees’ responsibilities. Each sales area is always the responsibility of a single salesperson, and our managers' and directors' responsibilities don’t overlap. Some-times our salespersons, managers, and directors will have special assignments and will not be responsible for sales. We identify all our sales personnel by their employee IDs.”

Hierarchical: Assume that every region must have at least one district and so on up to areas.


Recursive:
  • ·         To cover top and bottom entities in chain make optional on both end of pigs ear.
  • ·         Type attribute may take values e.g. area, territory, district region etc.
  • ·         To cover entities of type territory, relation b/w unit and employee on unit side becomes optional. (Additional information to be recorded with this : Each sales manager is responsible for the territories with his/her districts. But this does not mean I will store duplicate information with territories) 



No comments:

Post a Comment