1 / 49

Information Resources Management

Information Resources Management. February 6, 2001. Agenda. Administrivia Advanced E-R Modeling. Administrivia. Homework #2 Homework #3. Difficulties with Previous E-R Modeling. employee’s billing rate may vary by project

Lucy
Download Presentation

Information Resources Management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Information Resources Management February 6, 2001

  2. Agenda • Administrivia • Advanced E-R Modeling

  3. Administrivia • Homework #2 • Homework #3

  4. Difficulties with Previous E-R Modeling • employee’s billing rate may vary by project • attribute of the relationship between property and owner is percent owned • different types of bank accounts • customer must have at least one account of any type • tracking transactions

  5. Also, Cannot Handle Situations Like • different kinds of property for sale • single family, duplex, apartment building, commercial, industrial • different kinds of projects • internal, DoD, joint venture, other govt, other • employee assigned to a project has a specific location just for that project • billing rate for an employee can vary by both project and location

  6. Solutions • Associative Entities • Ternary (n-ary) relationships • Generalization/Specialization • Time Dependent Data (weak entities)

  7. Associative Entities • A relationship cannot have attributes • What happens when one or more attributes exist for a relationship? • Employee – Project – Billing Rate

  8. Associative Entities • An associative entity is an entity type that associates the instances of more or more entity types and contains attributes that are specific to the relationship between those entity instances. • NOUN

  9. Converting a relationship to an associative entity • Example • Employee’s billing rate can vary by project (employee to project, many-to-many) Billing Rate Employee Project

  10. Example: • Attribute of the relationship between property and owner is percent owned % Owned Owner Property

  11. Example: • Students take one or more courses • A course could be offered before any students register for it • Students are awarded mid-term and final grades for each course for which they are registered • Attributes for students include student ID, name, department • Attributes for course include course number, name, department Draw the E-R diagram

  12. Ternary Relationship • simultaneous relationship among one instance from each of exactly three entity sets • An associative entity is not required but is typical.

  13. Ternary Relationships – Cardinality • “one” – one instance of an entity is associated with each unique pair of the other two entities. • “many” – more than one instance of an entity is associated with each unique pair from each of the other two entities.

  14. Ternary Relationships - Cardinality • For the entity in question, • For one instance of the entity, • How many unique pairs of the other entities can there be? • One • More than one (many)

  15. Example(one-to-one-to-one): Employee is assigned a phone number for a project. A phone number is used only for that employee and project.

  16. Example (one-to-one-to-one): Employee Has Project Phone Number Note: An employee could still be assigned to multiple projects but would have a unique phone number for each project assignment.

  17. Example(one-to-one-to-many): Employee assigned to a project works at one location for that project but can work at different locations for different projects. At a location an employee only works on one project, but there can be many employees working on that same project.

  18. Example(one-to-one-to-many): Employee Has Project Location

  19. Example(one-to-many-to-many): Employee on a project has one manager. Manager can manage several projects. Each project has one manager. Manager can manage the same employee on different projects.

  20. Example(one-to-many-to-many): Employee Has Project Manager

  21. Example(many-to-many-to-many): Employees use many skills on many projects and each project has many employees with varying skills.

  22. Example(many-to-many-to-many): Employee Has Project Skill

  23. Ternary Relationships • Why not just make the ternary relationship an associative entity? Location Employee Project

  24. Good idea if possible. However, • “Business Rules” • Need for separate (strong) entity • What if location also related to other entities? • No longer valid as associative entity If you can safely get rid of ternary (or n-ary) relationships, DO IT. However, don’t trade correctness for ease of implementation.

  25. Example: • Employee assigned to a project works at one location and is only assigned to one project. However, projects can be at more than one location and have multiple employees working on them at each location. Multiple projects can be at the same location. Draw the E-R Diagram.

  26. Example: • Now, suppose employees have a billing rate that varies with both project and location. Update your E-R Diagram.

  27. Generalization/Specialization • Generalization: Defining a general entity type from a set of more specialized ones (bottom-up). • Specialization: Defining one or more specialized entities from a more general one based on distinguishing characteristics (top-down).

  28. Examples: • Generalization: Bank account generalized from checking, savings, and loan. • Specialization: Property for sale divided into single family, duplex, apartment, commercial, or industrial.

  29. Why use generalization or specialization? • clarity • more fully describe situation • conversion to OO (inheritance) • different relationships only apply to specific subtypes • monthly charges only made to checking accounts • different relationships only apply to the supertype • customer must have an account with the bank • different (additional) attributes for the subtypes

  30. Generalization/Specialization • Applies to entities only • Types: • disjoint – can be only one subtype • overlapping – can be more than one subtype • Completeness Constraint – subtypes fully inclusive of supertype

  31. Generalization/Specialization • Disjoint – student can be undergraduate, masters, or doctoral • Overlapping – major can be history, philosophy, or mathematics

  32. Completeness Constraint • Disjoint: • Completeness – student must be one and only one of the three • None – “at large” student is simply a student and the additional specialization isn’t needed

  33. Completeness Constraint • Overlapping: • Completeness – major must be at least one of the three listed • None - other majors not individually broken out but possible

  34. Drawing It – Disjoint d  - subset and direction indicator

  35. Drawing It – Overlapping O

  36. Drawing It – Completeness Constraint Double line d O

  37. Examples Student d underg masters doctor

  38. Examples Major O philosp history math

  39. Time Dependent Data • keep history over time • need to track changing attribute and know its past values • “timestamp” • year, month, day, etc… • as precise as nanoseconds

  40. Two Approaches • multivalued attribute • additional entity (weak)

  41. Example • A company sells products whose price can change at most once a day. Need to be able to track the price history.

  42. Multivalued Attribute Product ID Product Description Price Price History Effective Date Product Type

  43. Additional Entity Product Has Price History Why is price history a weak entity??

  44. Warnings for Time Dependent Data • Is it necessary? • How long must it be kept? • Will it get “cleaned up”? How? When? • Do other entities have relationships to the history information? • What happens to sales by product type if the product type is changed? • Exactly how much historical information needs to be kept? What attributes have historical values?

  45. The Steps in E-R Modeling • classify entities and attributes • identify generalization hierarchies • define relationships • All three simultaneous and iterative

  46. Exercise 1 • A real estate firm lists property for sale. The following describes this organization: • The firm has a number of sales offices in several states • Each sales office is assigned one or more employees. An employee must be assigned to only one sales office. • For each sales office, there is always one employee assigned to manage that office. An employee may manage only the sales office to which she is assigned. • The firm lists property for sale. • Each unit or property must be listed with one (and only one) of the sales offices. A sales office may have any number of properties listed, or may have no properties listed. • Each unit of property has one or more owners. An owner may own more than one unit of property. An attribute of the relationship between property and owner is percent owned.

  47. Exercise 1 - New • Property listed must be at least one of the following types: single family, apartment, commercial, industrial. • Single family property can be a house, duplex, condo, or townhouse. More than one is possible (ie, condo and townhouse) • A history of previous listings should be kept along with the sales prices and selling employees. • In a sales office, each employee has security access to one or more PCs. Managers have access to all PCs in their office as well as other offices. Different employees can have different levels of access. This access needs to be tracked. • Zoning information is kept for commercial and industrial properties only. • Gifts of varying values (based on the purchase price) are given to the purchasers of single family houses or townhouses only.

  48. Exercise 2 • Construct an E-R diagram for a bank database that shows the basic relationships among customers, checking accounts, savings accounts, loans, loan officers, and the bank branches where various accounts and loans are taken out. You also want to keep track of transactions on accounts and loans, and maintain the current balance in each account and the balance of the loan.

  49. Exercise 2 - New • CDs (certificates of deposit) are also offered. A CD must be one of four types – small, medium, large, and jumbo. The interest rate and minimum term vary with the type of CD and customer. “Special” customers (this is indicated in the customer information) receive higher interest rates or shorter terms. Customers who open a large or jumbo CD get to choose a free gift from a list of available ones. The gifts for each type of CD are different. • A loan officer may work at more than one branch. When an officer is assigned to multiple branches, she has a unique phone number at each branch. All other bank employees each have a unique phone number.

More Related