Answer Ch02

Embed Size (px)

Citation preview

  • 7/30/2019 Answer Ch02

    1/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    CHAPTER 2

    ENTITY-RELATIONSHIP DATA MODELING:

    TOOLS AND TECHNIQUES

    ANSWERS TO GROUP I QUESTIONS

    2.1 Explain the word schema in your own words.

    A schema is a description or representation of something that is real or imaginary. A schema is

    similar to a model in that is describes the way something is constructed.

    2.1 Name and explain the purpose of the three schemas in the ANSI/SPARC three schemamodel.

    The external schema, sometimes called the user view, is a representation of how users

    view the database. For all but the simplest databases, an external schema portrays just a portion ofthe database.

    A conceptual schema is a complete logical view of the database that contains a descriptionof all the data and relationships in the database. The conceptual schema is logical, in that it is

    independent of any particular means of storing the data.

    An internal schema is a representation of a conceptual schema as physically stored using aparticular product and/or technique. The description of a set of tables, keys, foreign keys, indexes,

    and other physical structures is an internal schema.

    2.2 Explain a circumstance under which an organization could have three different externalschemas for the same conceptual schema.

    At Lakeview, there might be one external schema for sales, one for marketing,one for operations, and so forth. Or for a university a conceptual schema for a student database

    could have an external schema for the president of the university, an external schema for a faculty

    member, and an external schema for a student.

    2.3 Describe how external schemas can be used to devise a conceptual schema.

    External schemas are descriptions of the world as end users see the world. During the database

    design process, designers collect information from end users and develop the different external

    schemas for the different end user groups. These different external schemas are then combined into

    one conceptual schema.

    2.4Why is it important not to confuse the conceptual schema with the internal schema?We do not want to mix the logical view of the data with the physical view. If we do, we may find

    that the characteristics of the DBMS will constrain and influence our thinking about the conceptual

    model. In this case, we may miss something important in the users worldor, even worse, cause

    the characteristics of a DBMS to constrain what the users can do. Such constraints allow the tail to

    wag the dog. We do not want the characteristics of DBMS indexes to determine how salespeople

    can sell!

    2-1

  • 7/30/2019 Answer Ch02

    2/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    2.5 What was the problem between Bruce and Zelda? Do you think they can ever agree on asingle way of viewing the data?

    The problem, is that Bruce and Zelda have two very different perspectives of the same data. The

    way they see the world and the way they interact with the world are different. They will probably

    not agree on a single way of viewing the data. It is Conrads job to develop a conceptual schema

    that can be used to represent both views.

    2.6 What is the difference between the E-R model and the extended E-R model?

    Subtypes were added to the E-R model to create the extended E-R model. Today, it is the extended

    E-R model that most people mean when they use the term E-R model.

    2.7 Why is IDEF1X important?

    IDEF1X became a national standard and companies that sold data modeling tools had to conform to

    IDEF1X in order to sell to the government. Such a large market could not be ignored, so most of

    todays popular data modeling products, such as ERWin and Visio, use IDEF1X. This means that

    IDEF1X is the E-R version you are most likely to encounter, even more so than the extended E-R

    model.

    2.8 Why is UML important?

    With the growing popularity of object-oriented systems development and object-oriented

    programming, the use of UML is on the rise.

    2.9 Define entity and give an example.

    An entity is something that can be identified in the users work environment; something that theusers want to track. Example entities are EMPLOYEE Mary Doe, CUSTOMER 12345, SALES-

    ORDER 1000, SALESPERSON John Smith, and PRODUCT A4200.

    2.10 Explain the difference between an entity class and an entity instance.

    An entity class is a collection of entities and is described by the structure or format of theentities in that class. An entity instance of an entity class is the representation of a particularentity, such as CUSTOMER 12345; it is described by the values of attributes of the entity. There

    are usually many instances of an entity in an entity class.

    2.11 Define attribute and give examples for the entity you described in question 2.10.

    Attributesdescribe the entitys characteristics. Examples of attributes are EmployeeName,DateOfHire, and JobSkillCode.

    2.12 Explain what a composite identifier is and give an example.

    Identifiers that consist of two or more attributes are called composite identifiers. Examples are{AreaCode, LocalNumber}, {ProjectName, TaskName}, and {CityName and State}.

    2.13 Which attribute defined in your answer to question 2.12 identifies the entity?

    EmployeeName, DateOfHire,

    2.14 Define relationship and give an example.

    2-2

  • 7/30/2019 Answer Ch02

    3/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    A relationship is an association between two or more entity classes. For example, assume you have

    an entity class named Student and an entity class named Class. Students Enroll in a Class so you

    would have a relationship named Enrolls In.

    2.15 Explain the difference between a relationship class and a relationship instance.

    Relationship classes are associations among entity classes, and relationship instances areassociations among entity instances.

    2.16 Define degree of relationship. Give an example, other than the one in this text, of arelationship greater than degree 2.

    The number of entity classes in the relationship is the degree of the relationship. Assume entityclasses FACULTY, STUDENT, and MAJOR. Now assume a FACULTY is assigned to advise a

    STUDENT for a given MAJOR.

    2.17 List and give an example of the three types of binary relationships. Draw an E-R diagramfor each.

    2.18 Define the terms maximum cardinality and minimum cardinality.

    Maximum cardinality is the maximum or larges number of entities that can occur on one side of

    the relationship. Minimum cardinality is the minimum or smallest number of entities that can

    occur on one side of the relationship.

    2.19 Name and sketch the symbols used in the extended E-R model entity-relationshipdiagrams for (a) entity, (b) relationship, (c) weak entity and its relationship, (d) recursiverelationship, and (e) subtype entity.

    2-3

    FACULTY OFFICE1:1

    STUDENT CLASSN:M

    FACULTY-LOCATION

    AUTO REPAIR1:N

    AUTO-REPAIR

    STUDENT-SCHEDULE

  • 7/30/2019 Answer Ch02

    4/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    2.20 Give an example E-R diagram for the entities DEPARTMENT and EMPLOYEE, whichhave a 1:N relationship. Assume that a DEPARTMENT does not need to have anyEMPLOYEE, but that every EMPLOYEE does have a DEPARTMENT.

    2.21 Give an example of a recursive relationship and show it in an E-R diagram.

    Assume employees are allowed to marry employees. Not all employees are married to employees

    but if an employee is married, they can one be married to one other employee.

    2.22 Define the term weak entity and give an example other than the one in this text.

    Weak entities are those that cannot exist in the database unless another type of entity also exists in

    the database. An entity that is not weak is called a strong entity. Assume that ROOMScannot exist unless they are in BUILDINGS.

    2-4

    STUDENT

    1:N

    EMPLOYEE 1:1 IS-MARRIED-TO

    1:N CITYSTATE

    (a) Entity

    (b) Relationship

    (c) Weak entity and Relationship

    (d) Recursive Relationship

    (e) Subtype

    PERSON

    STUDENT STAFF FACULTY

    m

    EMPLOYEE 1:1 IS-MARRIED-TO

    DEPARTMENT EMPLOYEE1:N

    EMPLOYEE-ASSIGNMENT

    1:N ROOMBUILDING

    BUILDING-CONTAINS

  • 7/30/2019 Answer Ch02

    5/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    2.23 Explain the ambiguity in the definition of the term weak entity. Explain how this term isinterpreted for the extended E-R model. Give examples other than those in this text ofeach type of weak entity.

    In a strict sense, if a weak entity is defined as any entity whose presence in the database depends onanother entity, then any entity that participates in a relationship having a minimum cardinality of 1

    to a second entity is a weak entity. OFFICES must have a BUILDING, CITY must be in a STATE,GRADE must belong to a STUDENT, REPAIR must be made to an AUTO.

    2.24 Define the term ID-dependent entity and give an example other than one in this text.

    An ID-dependent entity is one in which the identifier of one entity includes the identifier ofanother entity. If you assume that a city can be in only one state but states may havecities with the same name then to identify a city you need to know what state the cityis in. For example, there is a Bristol, TN and a Bristol VA.

    2.25 Show how to use an ID-dependent entity to represent the multivalued attribute Skill in anEMPLOYEE entity. Indicate both the maximum and minimum cardinalities on both sides ofthe relationship. Use extended E-R symbols.

    2.26 Show how to use an ID-dependent entity to represent the multi-value composite attributePhone that contains the single-value attributes AreaCode, PhoneNumber. Assume thatPhone appears in an entity called SALESPERSON. Indicate both the maximum andminimum cardinalities on both sides of the relationship. Use extended E-R symbols.

    2.27 Describe subtype entities and give an example other than those in this text.

    2-5

    1:N CITYSTATE

    CITY-IS-IN

    EMPLOYEE-SKILL

    1:N SKILLEMPLOYEE

    EMPLOYEE Contains:

    Emp IdEmp NameHire DateOther attributes

    SKILL Contains:

    Skill

    SALESPERSON-PHONE

    1:N PHONESALESPERSON

    SALESPERSON Contains:Sales IdSales NameSales TitleOther attributes

    PHONE Contains:Area CodePhone Number

  • 7/30/2019 Answer Ch02

    6/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    A subtype entity is an entity that represents a special case of another entity, called itssupertype. For example, the entity STUDENT could be modeled to havesubtypes of GRADUATE_STUDENT and UNDERGRADUATE_STUDENT. Or,STUDENT could be modeled to have subtypes BUSINESS_MAJOR,SCIENCE_MAJOR, LIBERAL_ARTS_MAJOR, and so forth.The entity BUILDING could be modeled to have subtypes of CLASSROOM, OFFICE, or

    RECREATIONAL. The entity CONGRESSPERSON could be modeled to have subtypes ofSENATOR or REPRESENTATIVE.

    2.28 Explain the statement In database processing, subtypes are used when values areinappropriate for some attributes of some entity instances. Show how this statementapplies to your answer to question 2.28.

    By inappropriate we mean that the attribute does not apply to certain instances of the entity. For

    example, if a building is an OFFICE building or a RECREATIONAL building then the attribute of

    Number_of_Desks would not apply but it would apply if the building were a CLASSROOM

    building. If a building were a RECREATIONAL building then the attribute Gym_Size would apply

    but it would not apply to an OFFICE or a CLASSROOM building.

    2.29 Explain the difference between a HAS-A relationship and an IS-A relationship, and give anexample of each.

    The relationship between a supertype and its subtypes is sometimes called an IS-A relationship. Entities

    with an IS-A relationship should have the same identifier because they represent different aspects

    of the same thing. Entities with an HAS-A relationships represent aspects of different things and

    thus have different identifiers. These relationships do not involve subtypes.

    BUILDINGs with an identifier of Building Code and subtypes of CLASSROOM, OFFICE, and

    RECREATIONAL have an IS-A relationship because all types of building are identified by the

    building code. In essence, all subtypes IS-A BUILDING.

    A binary relationship between ADVISOR and STUDENT would be a HAS-A relationship because

    a STUDENT HAS-A ADVISOR, ADVSIOR is not a type of STUDENT.

    2.30 Define primary key.

    The Primary key as the principal unique identifier of the entity.

    2.31 What is a foreign key and why are such keys inappropriate in a conceptual model?

    A foreign key is the Primary key of one table placed in a second table to form a relationship. When

    creating a conceptual model, one should focus on obtaining a model that supports all of the users

    views and needs for the data. One should not worry about foreign keys and the like. Such keysare part of the internal schema, not the conceptual schema

    2.32 What are non-identifying connection relationships?

    Non-identifying connection relationships are 1:1 or 1:N relationships between twonon-ID-dependent (hence non-identifying) entities. Connection relationships are the same aswhat are called HAS-A relationships in the extended E-R model.

    2.33 Give an example of a non-identifying connection relationship.

    2-6

    EMPLOYEE 1:1 IS-MARRIED-TO

  • 7/30/2019 Answer Ch02

    7/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    In the recursive relationship above the IS-MARRIED-TO relationship is a non-identifying

    relationship.

    2.34 Explain the meaning of a filled-in circle, a diamond, the letter P, the letter Z, and thenumber 1 in an IDEF1X E-R diagram.

    a filled-in circle: In IDEF1X, the default cardinality of a non-identifying connection relationship is

    one-to-many, with a mandatory parent and an optional child. Such relationships are shown by adashed line with a filled circle by the child, and no other notation.

    a diamond: If the parent is optional, a diamond is added to the line, adjacent to the parent.

    the letter P: If the child is required, a P is placed near the circle, indicating that one or more child

    entities are required (the P stands forpositive, as in positive number).

    the letter Z: a Z indicates that zero or one children are allowed.

    the number 1: A 1 indicates that exactly one child is required;

    2.35 What is the default cardinality of a non-identifying connection relationship?

    The default cardinality of a non-identifying connection relationship is one-to-many, with a

    mandatory parent and an optional child.

    2.36 How do identifying connection relationships relate to the extended E-R model?

    Identifying connection relationships are the same as ID-dependent relationships in the extended E-

    R model.

    2.37 What is the difference between a weak entity in the extended E-R model and anidentifying connection relationship in the IDEF1X model?

    In the IDEF1X model, rounded corners signify ID-dependent entities only. There is no way in

    IDEF1X to document a weak entity that is not an ID-dependent entity. Therefore, and weak entityin the IDE1X model is assumed to have an identifying relationship.

    2.38 How does the IDEF1X model represent a weak entity that is not ID-dependent?

    IDEF1X allows for weak entities that are not identifying, but provides no special notation for such

    entities. The minimum cardinality for the parent in such relationships is 1, but no other means exists

    for documenting the fact that they are logically dependent on their parent.

    2.39 How are N:M relationships represented in an IDEF1X model?

    A many-to-many relationship relationship is simply aNon-specific relationship.Non-

    specific relationships are shown with a filled-in circle on each end of the solid relationship line. InIDEF1X, there is no way to set minimum cardinalities of a non-specific relationship.

    2.40 Make the argument that N:M relationships do not exist. Give examples other than theones in this text in your answer.

    N:M relationships do not really exist because there is no conceptual data to represent them. They

    only appear to exist because something has been left out of the model. Such relationships have no

    direct expression in the relational model. During implementation, they must be converted to two1:N relationships therefore they do not exist as one N:M relationship but as two 1:N relationships.

    2-7

  • 7/30/2019 Answer Ch02

    8/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    RIVERS flow through many STATES and STATES and many RIVERS flowing through them.

    This is true even if a model does not allow you to show the relationship.

    2.41 Make the argument that N:M relationships do exist. Give examples other than the ones inthis text in your answer.

    One should be able to fully document an M:N relationship, including minimum cardinalities, in theconceptual model. What happens to that relationship later in designing the internal schema should

    not be a factor in conceptual design. A Passenger can be on many Flights and a Flight can havemany Passengers. However, for a Passenger to board a Flight they must have a Ticket fro each

    flight. This makes a 1:N relationship between Ticket and Passenger, and a 1:N relationship between

    Ticket and a Flight.

    2.42 Of the two arguments in your answers to question 2.41 and 2.42, which do you believe?

    I would argue that N:M relationships do exist. First they exist in the users view of their world.

    Secondly, what happens to that relationship later in designing the internal schema should not be afactor in conceptual design.

    2.43 Why? Explain the terms generic entity, category entity, and categorization cluster. Give anexample of each.

    A generic entity is similar to a super type in the E-R model. A STUDENT would be generic entity

    A category entity is similar to a subtype. If a STUDENT could be an UNDERGRADUATE-

    STUDENT, GRADUATE-STUDENT, or a SPECIAL-STUDENT these would be category entities.

    A categorization cluster is a group of category entities. In the example above the collection of

    UNDERGRADUATE-STUDENT, GRADUATE-STUDENT, and SPECIAL-STUDENT entities

    would be a categorization cluster.

    2.44 What is the role of a discriminator in a category relationship?

    A discriminator is an attribute of the generic entity that indicates the type of the category entity thegeneric entity is.

    2.45 Explain the difference between a complete category cluster and an incomplete categorycluster.

    In a complete category cluster, every possible type of category for the cluster is shown.Complete category clusters are denoted by two horizontal lines, with a gap in-between.

    In an incomplete category cluster, there may be types of categories that are not shown.

    2.46 Explain why the Z notation with complete category clusters is puzzling.

    The use of the Z notation may appear to be puzzling, if not wrong. As stated, categories in a cluster

    are mutually exclusive. Thus, after an entity has a relationship to one category entity, the cardinality

    of the relationship to the other entities in that cluster is zero. Additionally, the Z on the line between

    the generic entity and the cluster symbol indicates that a generic entity may or may not have a

    category entity. For complete clusters, the Z should be a 1 in some cases, indicating that the generic

    entity must have a relationship to a category entity. There is no way to specify a 1 in the IDEF1X

    model for this case.

    2.47 Explain the circumstances under which an entity instance may have a relation-ship to twoor more category entity instances.

    2-8

  • 7/30/2019 Answer Ch02

    9/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    This can occur only is the category entities are in different category clusters. For example a

    STUDENT may have a relationship to a GRATUATE-STUDENT category entity in one cluster

    and a relationship to OFF-CAMPUS-STUDENT in a different cluster.

    2.48 What are the differences between a categorization relationship in the IDEF1X model andsubtypes/supertypes in the extended E-R model?

    The IDEF1X model adds structure to the generalization/subtype relationships in the extended E-R

    model. By further defining these concepts, the IDEF1X model makes them more meaningful andhence more useful.

    2.49 Explain the normal way that relationships are named.

    Normally, a name consists of a verb or verb phrase expressed from the standpoint of the parent in

    the relationship, followed by a slash, and followed by the verb phrase expressed from the

    standpoint of the child. Normally, the verb phrase from the childs view is the passiveform of the verb phrase from the parents view.

    2.50 When are relationship names particularly useful?

    They can be helpful, however, when the relationship between two entities is ambiguous. In Figure2-25, there are two relationships between CUSTOMER and SALE. One relationship is used to

    document that a customer can buy something; a second is used to document that a customer can sell

    something.

    2.51 What is a domain?

    A domainis a named set of values that an attribute can have. A domain can consist of a specificlist of values, or it can be defined more generally for example, as a set of strings of maximum

    length 50.

    2.52 Explain two ways that domains reduce ambiguity.

    Domains can reduce ambiguity when two attributes have the same name but represent differentthings. For example, different entities may have an attribute of Tax. If this were Sales Tax for one

    attribute and Income Tax for the other attribute, domains could be defined to distinguish between

    the two.

    Furthermore, named domains eliminate ambiguity from attributes whose values look similar, but

    are not the same.

    2.53 Describe how domains are practically useful.

    One way domains become useful is to assign like attributes to the same domain. For example, if

    you create a domain for Dates and the domain used a format of MM-DD-YY, all dates assigned to

    that domain would be forced to use that format. If you decided that the formats for dates need the

    four-digit year you could change the domain and all dates would now use the new format.

    Another practical use for domains is to assess whether two attributes that are named differently are

    referring to the same thing. They would be if they have the same domain.

    2.54 Define base domain.

    A base domain is a domain having a data type and possibly a value list or range definition.

    2.55 Define type domain.

    2-9

  • 7/30/2019 Answer Ch02

    10/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    A type domain is a subset of a base domain or a subset of another type domain. Type domainsallow the definition of domain hierarchies that can be used for greater specificity.

    ANSWERS TO GROUP II QUESTIONS

    Use the STUDENT ACTIVITY IDEF1X diagram in Figure 2-32 to answer the following questions:

    2.56 Consider the relationship between STUDENT and EQUIPMENT:

    A. What type is this relationship?

    Non-Identifying Connection Relationship

    B. What are the maximum cardinalities?

    The maximum cardinalities are 1:N. A STUDENT can have many EQUIPMENTs but anEQUIMENT can belong to only one STUDENT.

    C. What are the minimum cardinalities?

    The minimum cardinalities are zero on both sides. An EQUIPMENT does not require a

    STUDENT as indicated by the diamond. A STUDENT is not required to have an

    EQUIPMENT indicated by using the default.

    D. Describe any cardinality changes that you think should be made. Justify your changes.

    No changes. Since Students are no required to take course they would not be required to be

    assigned equipment. It is also possible that a course does not have students so the equipmentmay not be assigned to a student.

    E. Give an appropriate name for this relationship.

    Assigned/Assigned To

    2.57 Consider the relationship between EQUIPMENT and COURSE:

    A. What type is this relationship?

    Non-Identifying Connection Relationship

    B. What are the maximum cardinalities?

    The maximum cardinalities are 1:N. A COURSE can have many EQUIPMENTs but an

    EQUIMENT can belong to only one COURSE.

    C. What are the minimum cardinalities?

    The minimum cardinalities are zero AND 1. An EQUIPMENT must be assigned to a COURSE

    (default cardinality). A COURSE is not required to have EQUIPMENT indicated by using the

    default.

    D. Describe any cardinality changes that you think should be made. Justify your changes.

    No changes.

    2-10

  • 7/30/2019 Answer Ch02

    11/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    E. Give an appropriate name for this relationship.

    Uses/Used by

    2.58 In Figure 2-32, COURSE describes a course such as Beginning Kayaking or IntermediateScuba; CLASS describes a particular offering of a course, such as the class Beginning

    Kayaking offered on January 7, 2003. For the relationship between COURSE and CLASS:

    A. What type is this relationship? Is this the correct type for this relationship?

    Identifying Connection Relationships since the key of the class would include the key of the

    course (course name). YES, the correct type of relationship is shown.

    B. What are the maximum cardinalities?

    The maximum cardinalities are 1:N. A COURSE can have many CLASSes but a CLASS can

    belong to only one COURSE.

    C. What are the minimum cardinalities?

    The minimum cardinalities are zero AND 1. A CLASS must be assigned to a COURSE (defaultcardinality). A COURSE is not required to have CLASSes indicated by using the default.

    D. Describe any cardinality changes that you think should be made. Justify your changes.

    No changes.

    E. Give an appropriate name for this relationship.

    Offers/Offered By

    2.59 Consider the relationship between CLASS_FEE and CLASS:

    A. What type is this relationship?

    Non-Identifying Connection Relationship

    B. What are the maximum cardinalities?

    The maximum cardinalities are 1:N. A CLASS can have many CLASS_FEEs but a

    CLASS_FEE can belong to only one CLASS.

    C. What are the minimum cardinalities?

    The minimum cardinalities are zero AND 1. A CLASS_FEE must be assigned to a CLASS

    (default cardinality). A CLASS is not required to have CLASS_FEE indicated by using the

    default.

    D. Describe any cardinality changes that you think should be made. Justify your changes.

    No changes. Students are not required to have classes so a class may not have a fee. If a student

    pays a fee it must be assigned to a class.

    E. Give an appropriate name for this relationship.

    Pays/Charges

    2-11

  • 7/30/2019 Answer Ch02

    12/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    2.60 Consider the relationship between CLASS_FEE and STUDENT:

    A. What type is this relationship?

    Non-Identifying Connection Relationship

    B. What are the maximum cardinalities?

    The maximum cardinalities are 1:N. A STUDENT can pay many CLASS_FEEs but a

    CLASS_FEE can belong to only one CLASS.

    C. What are the minimum cardinalities?

    The minimum cardinalities are zero and zero. A CLASS_FEE is not required to be assigned to

    a CLASS as indicated by the diamond. A COURSE is not required to have a CLASS_FEE

    indicated by using the default.

    D. Describe any cardinality changes that you think should be made. Justify your changes.

    Change the minimum cardinality to STUDENT to the default (required) by removing the

    diamond. If a CLASS_FEE does not require a STUDENT, who pays the fee?.

    E. Give an appropriate name for this relationship.

    Pays/Paid By

    2.62 Consider the relationship between STUDENT and CLUB:

    A. What type is this relationship?

    Non-specific Relationship

    B. Describe a possible new entity that would change this relationship into two non-identifying connection relationships. Specify appropriate cardinalities for your newrelationships.

    MEMBERSHIP: This entity would include attributes such as Member_Id, Date_joined, and

    Dues_Paid. The cardinalities would be 1:M between CLUB and MEMBERSHIP (Clubs can

    have zero to many Memberships but a Membership must be for a single Club). 1:N between

    STUDENT and MEMBERSHIP (Students can have zero to many Memberships but each

    Membership must belong to exactly one Student.

    C. Do you think the design in your answer to question B is a better design than therelationship shown in this figure?

    YES, there are attributes that do not belong to either the CLUB or the STUDENT (Member_Id,

    Date_Joined, and Dues_Paid. This design allows you to show a cleared design.

    2.63Add a new entity called INSTRUCTOR. Create a new relationship between INSTRUCTORand COURSE and a new relationship between INSTRUCTOR and EQUIPMENT.

    A. Justify the type of relationships you have chosen.

    Non-Identifying Connection Relationship. Both relationships would be 1:N. They are non-

    identifying because Instructor, Equipment, and Course have their own identifiers.

    2-12

  • 7/30/2019 Answer Ch02

    13/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    Note that these relationships would probably make the relationship between

    EQUIPMENT and COURSE unnecessary.

    B. Specify cardinalities for your new relationships.

    Both relationships would be 1:N. An Instructor could teach from zero to many Courses but a

    Course must have one Instructor. An instructor may have from zero to many Equipments (zeroif they do not teach a course, many if they teach at least one course) but Equipment must be

    assigned to only one Instructor since the Equipment must be assigned to one Course and theCourse must have one Instructor.

    C. Name your new relationships.

    Between INSTRUCTOR and EQUIPMENT: Uses-Used By

    Between INSTRUCTOR and COURSE: Teaches-Taught By

    D. Redraw the diagram in Figure 2-32 to show your new relationships. Place allcardinalities from your answers to questions 2.57 to 2.62 on this diagram.

    2.64 Modify your answer in question 2.63 to make INSTRUCTOR and CLUB_OFFICERcategory entities of STUDENT.

    A. Should you use a complete or an incomplete category cluster? Explain your answer.

    Incomplete Category Cluster. Students are not required to members of a Club so there will be

    Students that are not Club_Officers. We must assume that not all Students are Instructors to

    there will be Students that are neither Instructors nor Club_Officers.

    B. Name and describe an attribute that could be used as a discriminator for this categorycluster.

    Student_Status. This would be a code to indicate that the Student is an Officer (value O) or

    Instructor (value I). If the Student is neither the value would be null.

    C. Redraw the diagram in your answer to question 2.63 to show your new relationships.

    2-13

    INSTRUCTOR

    EQUIPMENT

    COURSE

    STUDENTCLUB

    CLASS_FEE

    CLASS

  • 7/30/2019 Answer Ch02

    14/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    Use the EMPLOYEE TRIP IDEF1X diagram in Figure 2-33 to answer the following questions:

    2.65 Consider the relationship between EMLOYEE and TRIP:

    A. What type is this relationship?

    Non-Identifying Connection Relationship

    B. What are the maximum cardinalities?

    The maximum cardinalities are 1:N. An EMPLOYEE can have many TRIPs but a TRIP canbelong to only one EMPLOYEE.

    C. What are the minimum cardinalities?

    The minimum cardinalities are zero and zero. A TRIP is not required be assigned to an

    EMPLOYEE as indicated by the diamond. AN EMPLOYEE is not required to have TRIP,

    indicated by using the default.

    D. Describe any cardinality changes that you think should be made. Justify your changes.

    Change the minimum cardinality at the Employee to mandatory by removing the diamond. If

    the Trip does not belong to an Employee, who is taking the trip?

    E. Give an appropriate name for this relationship.

    Takes/Taken By

    2.66 Consider the relationship between TRIP and AIRLINE_RESERVATION:

    A. What type is this relationship?

    Non-Identifying Connection Relationship

    B. What are the maximum cardinalities?

    The maximum cardinalities are 1:N. A TRIP can require many AIRLINE_RESERVATIONSs

    but an AIRLINE_RESERVATION can belong to only one TRIP.

    C. What are the minimum cardinalities?

    2-14

    INSTRUCTOR EQUIPMENT

    COURSE

    STUDENTCLUBCLASS_FEE

    CLASS

    CLUB_OFFICER

    Z

    ZZ

  • 7/30/2019 Answer Ch02

    15/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    The minimum cardinalities are zero and zero. An AIRLINE_RESERVATION does not need to

    be assigned to a TRIP as indicated by the diamond. A TRIP is not required to have an

    AIRLINE_RESERVATION indicated by using the default.

    D. Describe any cardinality changes that you think should be made. Justify your changes.

    Change the minimum cardinality at the Trip to mandatory by removing the diamond. If theAirline Reservation does not belong to a Trip, why do we even have a reservation?

    E. Give an appropriate name for this relationship.

    Requires/Reserved For

    2.67 Consider the relationship between TRIP and CAR_RESERVATION:

    A. What type is this relationship?

    Non-Identifying Connection Relationship

    B. What are the maximum cardinalities?

    The maximum cardinalities are 1:N. A TRIP can require many AIRLINE_RESERVATIONSs

    but an AIRLINE_RESERVATION can belong to only one TRIP.

    C. What are the minimum cardinalities?

    The minimum cardinalities are zero and zero. An AIRLINE_RESERVATION does not need to

    be assigned to a TRIP as indicated by the diamond. A TRIP is not required to have an

    AIRLINE_RESERVATION indicated by using the default.

    D. Describe any cardinality changes that you think should be made. Justify your changes.

    Change the minimum cardinality at the Trip to mandatory by removing the diamond. If the

    Airline Reservation does not belong to a Trip, why do we even have a reservation?

    E. Give an appropriate name for this relationship.

    Requires/Reserved For

    2.68 Consider the relationship between TRIP and HOTEL_RESERVATION:

    A. What type is this relationship?

    Non-Identifying Connection Relationship

    B. What are the maximum cardinalities?

    The maximum cardinalities are 1:N. A TRIP can require many HOTEL_RESERVATIONSsbut an HOTEL_RESERVATION can belong to only one TRIP.

    C. What are the minimum cardinalities?

    The minimum cardinalities are zero and 1. An HOTEL_RESERVATION must be assigned to aTRIP as indicated by the default. A TRIP is not required to have a HOTEL_RESERVATION,

    indicated by using the default.

    D. Describe any cardinality changes that you think should be made. Justify your changes.

    2-15

  • 7/30/2019 Answer Ch02

    16/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    No Changes

    E. Give an appropriate name for this relationship.

    May Require/Reserved For

    2.69 Consider the relationships among AIRLINE_RESERVATION, E_TICKET, andPAPER_TICKET:

    A. What type is this relationship?

    Complete Categorization Relationship

    B. What are the maximum cardinalities?

    An Airline_Reservation must be either an E_Ticket or a Paper_Ticket but not both. Each

    E_ticket or Paper_Ticket can be only one Airline_Reservation. This gives a maximum

    cardinality of 1:1.

    C. What are the minimum cardinalities?

    Since all E_Tickets must be Airline_Reservations but Airline_Reservations are not required to

    be E_Tickets, the minimum cardinality here is 1 and zero. Since all Paper_Tickets must be

    Airline_Reservations but Airline_Reservations are not required to be Paper_Tickets, the

    minimum cardinality here is 1 and zero. Note that since this is a complete Categorization

    Relationship, the Generic entity Airline_Reservation must have one E_Ticket or one

    Paper_Ticket so the minimum cardinality between the Airline_Reservation and the category

    cluster is 1 and 1.

    D. Is this a complete or an incomplete category cluster? Should it be a different type ofcategory cluster?

    It is a complete category cluster. I would argue that this is appropriate. I can think of no other

    type of ticket required by an airline.

    E. Give an example discriminator for this relationship.

    Ticket_Type: This would be a code carrying one of two values, E for E_Ticket and P for

    Paper_Ticket.

    2.70Add a new entity called EXPENSE_REPORT. Create a new relationship betweenEMPLOYEE and EXPENSE_REPORT and a new relationship between TRIP andEXPENSE_REPORT.

    A. Justify the type of relationships you have chosen.

    Both relationships are Non-Identifying Connection Relationships. Each instance of therelationship will be for an expense item for and EMPLOYYE on a TRIP. It is not an Identifying

    Connection Relationship because each expense item would have its own identifier. It is not a

    Non-Specific Relationship because it is not a many-to-many relationship. It is not a

    Categorization Relationship because Expense Reports are not Employees or Trips.

    B. Specify cardinalities for your new relationships.

    2-16

  • 7/30/2019 Answer Ch02

    17/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    The relationship between Employee and Expense_Report is 1:N. An Employee may have zero

    instances of Expense_Report since they may not take Trips or they may have many, especially

    is they take more than one Trip. An Expense_Report instance must belong to an Employee and

    only one Employee.

    The relationship between Trip and Expense_Report is also a 1:N. A Trip may have zero

    instances of Expense_Report since they are not required to have any reservations or they mayhave many since they can have both airline and hotel reservations. An Expense_Report instance

    must belong to a Trip and only one Trip.

    C. Name your new relationships.

    Employee and Expense_Report: Submits-Submitted By

    Trip and Expense_Report: Charges-Charged To

    D. Redraw the diagram in Figure 2-33 to show your new relationships.

    2.71 Modify your answer in question 2.70 to make BUSINESS and PERSONAL categoryentities of TRIP. Assume that there can be no relationship between EXPENSE_REPORTand PERSONAL.

    A. Should you use a complete or an incomplete category cluster?

    Complete. Expense_Report instances should be either Business or Personnal.

    B. Name and describe an attribute that could be used as a discriminator for this categorycluster.

    Expense_Category. The value would be P for Personnal and B for Business.

    C. Redraw the diagram in your answer to question 2.70 to show your new relationships.

    2-17

    EMPLOYEE

    HOTEL_RESERVATIONAIRLINE_RESERVATIONCAR_RESERVATION

    TRIP

    PAPER_TICKETE_TICKET

    EXPENSE_REPORT

  • 7/30/2019 Answer Ch02

    18/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    2.72 Consider the relationship between FISH and OBSERVATION:

    A. What type is this relationship?

    Non-Identifying Connection Relationship

    B. What are the maximum cardinalities?

    The maximum cardinalities are 1:N. A FISH can require many OBSERVATIONs but an

    OBSERVATION can belong to only one FISH.

    C. What are the minimum cardinalities?

    The minimum cardinalities are zero and zero. An OBSERVATION may not be for a FISH

    indicated by the diamond. A FISH is not required to have an OBSERVATION, indicated by

    using the default.

    D. Describe any cardinality changes that you think should be made. Justify your changes.

    Change the minimum cardinality to the default of one (remove the diamond). Based upon

    Figure 2-4 of the text, no observation is recorded unless some type of fish is counted.

    E. Give an appropriate name for this relationship.

    Found During/Observed For

    2.73 Consider the relationship between RIVER and OBSERVATION:

    A. What type is this relationship?

    Non-Identifying Connection Relationship

    B. What are the maximum cardinalities?

    2-18

    EMPLOYEE

    HOTEL_RESERVATION AIRLINE_RESERVATION

    CAR_RESERVATION

    TRIP

    PAPER_TICKETE_TICKET

    EXPENSE_REPORT

    BUSINESS PERSONNAL

    Z

    ZZ

  • 7/30/2019 Answer Ch02

    19/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    The maximum cardinalities are 1:N. A RIVER can require many OBSERVATIONs but an

    OBSERVATION can belong to only one RIVER.

    C. What are the minimum cardinalities?

    The minimum cardinalities are one and one. An OBSERVATION must be for a RIVER

    indicated by using the default. A RIVER is required to have at least one OBSERVATION,indicated by using the P forpositive number.

    D. Describe any cardinality changes that you think should be made. Justify your changes.

    No Changes

    E. Give an appropriate name for this relationship.

    Location of/Recorded at

    2.74Add a new entity called RIVER_SITE as a child entity in an identifying connectionrelationship to RIVER. Remove the relationship between RIVER and OBSERVATION and

    place a new relationship between OBSERVATION and RIVER_SITE.

    A. Define and justify cardinalities between RIVER and RIVER_SITE.

    This should be a 1:N relationship. Each River could have several Observation_Sites and an

    Observation_Site must be located on a River since the relationship is an identifying connection

    relationship.

    B. Define and justify cardinalities between RIVER_SITE and OBSERVATION.

    This relationship is also a 1:N relationship. Many Observations can be made at a site and all

    observations must be made at one site.

    C. Name your new relationships.

    River and Observation_Site: Has/Location Of

    Observation and Observation_Site: Records/Made at

    D. Redraw Figure 2-34 given your new design.

    2.75Add a new entity called OBSERVER to your answer to question 2.74. Create arelationship between OBSERVATION and OBSERVER. Also, add a category cluster toOBSERVER with two categories: PROFESSIONAL and VOLUNTEER.

    A. What type of relationship is appropriate? Justify your answer.

    2-19

    FISH

    OBSERVATION

    RIVER

    RIVER_SITE

  • 7/30/2019 Answer Ch02

    20/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    The relationship between OSERVER and OBSERVATION is a non-identifying connection

    relationship. It is not an identifying connection relationship because OBSERVATION would

    have is own independent identifier. It is not a non-specific relationship because it is not a many-

    to-many relationship. It is not a categorization relationship because Observations are not a type

    of Observer.

    B. Define and justify cardinalities between OBSERVER and OBSERVATION. Name thisrelationship.

    Makes-Made By; Cardinalities are 1:N. An Observation must be made by someone (an

    Observer) and each Observation is made by a single Observer (Bruce or Zelda). An Observer

    and make many Observations or it may be possible that a new Observer made make zero

    observations.

    C. What type of category cluster is appropriate?

    Complete: This does assume that all observers will either be Professional or Volunteers.

    D. Redraw your answer to question 2.74 given your new design.

    2.76Create a new entity called CLASS. Construct a relationship between VOLUNTEER andCLASS.

    A. What type of relationship is appropriate? Justify your answer.

    It is not a non-specific relationship because it is not a many-to-many relationship. A Volunteer

    may take many classes and a Class may be taken by many different Volunteers. It is not a non-

    identifying connection relationship because it is not a 1:N relationship. It is not an identifying

    connection relationship because Class would have is own independent identifier. It is not a

    categorization relationship because Classes are not a type of Volunteer.

    B. Redraw your answer to question 2.75 given your new relationship.

    2-20

    FISH OBSERVATION RIVER

    OBSERVER

    VOLUNTEERPROFESSIONAL

    RIVER_SITE

  • 7/30/2019 Answer Ch02

    21/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    C. Create another entity called CLASS_OFFERING, which represents a particular offeringof a particular class. Add and remove relationships as appropriate. For each newrelationship, give the type, give the cardinalities, and name the relationship.

    The relationship between Class and Class_Offering would be an identifying connectionrelationship with a one to many cardinality. Each Class may have many offerings but any

    offering is of a single class. The relationship would be named Has-Offered For.

    The original relationship between Volunteer and Class is replaced by a relationship between

    Volunteer and Class_Offering. A Volunteer would attend an offering of a class, not all

    offerings of a class. The relationship would still be a non-specific relationship because it is a

    many-to-many. The relationship would be name Attends-Attended By.

    D. Redraw your answer to question 2.75 given your new design.

    2.77 The Public Affairs Office at Highline University receives requests for speakers onparticular topics. To be able to respond to such request, that office wants to build adatabase. In particular, it wants to keep track of topics, speakers, speeches, andorganizations to which someone from Highline has spoken.

    A. Make a list of possible entities for the Speaker database.

    TOPICS

    SPEAKERS

    SPEECHES

    ORGANIZATIONS

    2-21

    FISH OBSERVATION RIVER

    OBSERVER

    CLASSVOLUNTEERPROFESSIONAL

    RIVER_SITE

    FISH OBSERVATION RIVER

    OBSERVER CLASS

    CLASS_OFFERINGPROFESSIONAL VOLUNTEER

    RIVER_SITE

  • 7/30/2019 Answer Ch02

    22/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    B. Create an IDEF1X E-R diagram showing only entities (like Figure 2-34). Assume thatthere is an M:N relationship between SPEAKER and TOPIC.

    C. For each relationship in your diagram, specify the relationship type, and the minimumand maximum cardinality on both parent and child. Name each relationship.

    SPEAKER and TOPIC: This would be a non-specific relationship because it is a many-to-many

    relationship.

    SPEAKER and SPEECHES

    SPEECHES and ORGAINZATIONS

    D. Repeat questions B and C, but add an entity to your diagram so that there will be noN:M relationship.

    E. Do you prefer the design in question B and C or the design in question D? Justify yourpreference.

    2.78 The Metropolitan Housing Agency (MHA) is a non-profit organization that advocates the

    development and improvement of low-income housing. The MHA operates in a metropolitan area

    of approximately 2.2 million people in a midwestern city. The MHA maintains data about the

    location, availability, and condition of low-income housing in 11 different census tracts in themetropolitan area. Within the boundaries of these tracts are approximately 250 different buildingsthat provide low-income housing. On average, each building contains 25 apartments or other units.

    The MHA keeps data about each census tract, including geographic boundaries, median income of

    the population, elected officials, principal businesses, principal investors involved in attributes in

    that tract, and other demographic and economic data. It also maintains a limited amount of data

    about crime. For each building, the MHA stores the name, address, size, owner(s)s name and

    address, mortgagor(s)s name and address, renovations and repairs, and avail-ability of facilities for

    handicapped people. In addition, the MHA keeps a list of each of the units within each building,

    including the type of unit, size, number of bedrooms, number of baths, kitchen and dining facilities,location in the building, and any special remarks. The MHA wants to maintain data regarding the

    average occupancy rates for each unit, but to date it has been unable to collect or store such data.

    The MHA does, however, keep data about whether a given unit is occupied.

    The MHA serves as an information clearinghouse and offers three basic ser-vices. First, it works

    with politicians, lobbyists, and advocacy groups to support legislation that encourages the

    development of low-income housing through tax incentives, developmental zoning preferences, and

    other legislative inducements. To accomplish this, the MHA provides information about low-

    income housing to state, county, and city governments. Second, through speeches, seminars,displays at conventions, and other public relations activities, the MHA officials strive to raise the

    communitys consciousness about the need for low-income housing. Finally, the MHA provides

    2-22

    TOPICS

    SPEAKERS SPEECHES

    ORGANIZATIONS

  • 7/30/2019 Answer Ch02

    23/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    information about the availability of low-income housing to other agencies that work with the low-

    income and homeless populations.

    A. Make a list of possible entities for a database to support MHAs information needs.

    Elected Officials

    Principle Businesses

    Principle Investors

    Census Tract

    Building

    Apartment

    Crime

    B. Construct an IDEF1X entity-relationships diagram for the entities in question A.

    C. Name each relationship and ensure that you have correctly defined the minimum andmaximum cardinalities.

    These are shown on the diagram above.

    Note: You may find that as you answer question B, you will add, remove, or change some of the

    entities in your answer to question A. This is normal and very typical of the data modeling

    process. Just keep working back and forth until you have an IDEF1X E-R diagram that you

    believe is correct.

    ANSWERS TO FIREDUP PROJECT QUESTIONS

    Consider the situation of FiredUp, which was discussed at the end of Chapter 1. Assume that FiredUp has

    now developed a line of three different stoves: FiredNow, FiredAlways, and FiredAtCamp. Further,assume that the owners are selling spare parts for each of their stoves and that they also are making stove

    repairs. Some repairs are at no charge because they are within the stove warranty period; other repairs are

    2-23

    CENSUS TRACT CRIME

    BUILDING

    OFFICIAL BUSINESS INVESTOR

    UNIT

    Represents/Represented by

    Has/Is_committed_InHas/Is_located_In

    Contains/Is_In

    Is_In/Contains

    Invests_In/Has

  • 7/30/2019 Answer Ch02

    24/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    made at a charge for parts only; and still others are made for parts and labor. FiredUp wants to keep track

    of all of these data. When asked for further details, the owners made the following list:

    CUSTOMER: Name, StreetAddress, ApartmentNumber, City, State/Province, Zip/PostalCode,

    Country, EmailAddress, PhoneNumber

    STOVE: SerialNumber, Type, ManufactureDate, InspectorInitials

    INVOICE: InvoiceNumber, Date, Customer with a list of items and prices that were sold,

    TotalPrice

    REPAIR: RepairNumber, Customer, Stove, Description with a list of items that were used in the

    repair and the charge for them (if any), TotalAmount of the repair

    PART: Number, Description, Cost, SalesPrice

    A. Create an extended E-R entity-relationship diagram of a database for FiredUp. Set theminimum and maximum cardinality of the relationships among entities, as you think isappropriate. Explain your rationale for each cardinality value. Use weak entities asappropriate. Do not use subtypes. Name any ID-dependent entities, if any.

    CUSTOMER may have from zero to many INVOICEs. If they ordered long ago, the invoice

    may no longer exist. They could have multiple invoices if they have ordered more than onestove at different times. An INVOICE must belong to a CUSTOMER and cannot belong to

    more than one customer.

    An INVOICE may be for more than one STOVE but it must be for at least one stove. A

    STOVE may not be on an INVOICE (it could be in for repair) but it cannot be on more than

    one invoice (cannot be sold to two different people).

    A REPAIR must be made for a CUSTOMER and not more than one customer. A Customer

    may have more than one stove in for repair or they may not have any stoves in for repair.

    PARTs can be used on more than one REPAIR but do not have to be used on any repair. A

    repair may require multiple parts or may not require any parts.

    A STOVE may be REPAIRED more than once or it may never be repaired. A repair must bemade on exactly one stove.

    B. Modify the entity-relationship diagram in your answer to question A by representingINVOICE and REPAIR with appropriate subtypes. Under what circumstances is thisdesign better than the one in your answer to question A?

    This model is much more restrictive than the one in A. I would probably use this model only if

    a customer were not allowed to purchase a stove and parts at the same time.

    2-24

    CUSTOMER REPAIR

    PARTSTOVEINVOICE 1:N

    1:N

    1:N N:MN:1

  • 7/30/2019 Answer Ch02

    25/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    C. Transform your answer to question B to an IDEF1X diagram. Make changes tosubtypes and weak entity relationships as appropriate.

    D. Suppose that FiredUp wants to keep track of home, fax, and cell phone numbers aswell as multiple e-mail addresses for each of its customers. Modify your model in A toallow for multiple values of PhoneNumber and EmailAddress. You can use either theextended E-R diagram or the IDEF1X diagram, depending on which you prefer.

    2-25

    1:NCUSTOMER REPAIR

    PART

    STOVE_INV

    INVOICE

    1:N

    1:N

    N:M

    N:1

    STOVE

    PARTS_INV

    1

    WARRENTY PARTS_ONLY PARTS&LABOR

    1

    N:M

    CUSTOMER REPAIR

    PART

    STOVE_INV

    INVOICE

    STOVE

    PARTS_INV

    WARRENTY PARTS_ONLY PARTS&LABOR

    Z

    Z Z

    Z

    Z

  • 7/30/2019 Answer Ch02

    26/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    E. Suppose that FiredUp develops different versions of the same stove product. Thus, itdevelops a FiredNow Version 1 and a FiredNow Version 2, and so on. AlthoughFiredUp could consider each version of a stove to be a new product, it does not wantto do that. Modify your entity-relationship diagram from question D as necessary toaccount for this situation. You can use either extended E-R or IDEF1X format,depending on which you prefer.

    2-26

    CUSTOMER REPAIR

    PARTSTOVEINVOICE 1:N

    1:N

    1:N N:MN:1

    PHONE EMAIL_ADDRESS

    N:1 N:1

    CUSTOMER REPAIR

    PARTSTOVEINVOICE 1:N

    1:N

    1:N N:MN:1

    PHONE EMAIL_ADDRESS

    N:1 N:1

    VERSION1 VERSION2 VERSION3

    1

    CUSTOMER REPAIR

    PARTSTOVEINVOICE 1:N

    1:N

    1:N N:MN:1

    PHONE EMAIL_ADDRESS

    N:1 N:1

  • 7/30/2019 Answer Ch02

    27/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    ANSWERS TO TWIGS TREE TRIMMING SERVICE

    Consider the situation of Samantha Green, who owns and operates Twigs Tree Trimming Service,

    described at the end of Chapter 1. Although many of her jobs are one-time operations to remove a tree orstump, others are recurring: trimming a tree or groups of trees every year or every other year. When

    business is slow, she calls former clients to remind them of her service and of the need to trim their treeson a regular basis.

    Samantha grinds the branches and trunks that she cuts into small chips using a chip grinder that she tows

    behind her truck. The chips are thrown into the back of her truck as they are ground. For years, Samantha

    took these chips to the recycling center, but recently she discovered that she could sell these chips to

    nurseries and organizations for use as mulch. Even more recently, she discovered that some of her own

    tree-trimming customers want to buy chips as well. (Yes, it is possible that customers could pay her to cuta tree and grind the branches, and repurchase their own chips as mulch some time later. Samanthas

    response to that was, I love America!)

    Samantha keeps the following data:

    OWNER OwnerName, Phone, Street, City, State, Zip

    RECURRING_SERVICE MonthsBetweenService, Description, ServiceFee

    SERVICE DateOfService, Description, AmountBilled, AmountPaid, DateOfPayment

    CHIP_DELIVERY CustomerName, Phone, Street, City State, Zip, DateDelivered, LoadSize,

    AmountBilled, AmountPaid

    A. To begin, assume that all jobs are recurring. Create an IDEF1X E-R diagram forOWNER, RECURRING_SERVICE, and SERVICE. Model the relationship betweenRECURRING_SERVICE and SERVICE as an ID-dependent entity. State the type ofall relationships, give the minimum and maximum cardinalities, and name eachrelationship.

    Owner and Recurring Service: Non-Identifying connection relationship, Owner may have from

    zero to many Recurring services, Recurring service must belong to exactly one Owner,

    HasPerformed/PerformedFor

    Recurring Service and Service: Identifying connection relationship, Recurring Service can have

    from one to many Services, Service must belong at exactly one Recurring Service,

    PerformedLast/BelongsTo

    B. Now, assume that no jobs are recurring. That is, remove RECURRING_SERVICE andmodel SERVICE as a strong entity. Create an IDEF1X model: state the type of allrelationships, give the cardinalities, and name each relationship.

    2-27

    PhoneOwnerNameStreetCityStateZip

    OWNER SERVICE

    RECURRING SERVICE

    DescriptionMonthsBetweenServiceServiceFee

    DateOfServiceDescription

    AmountBilledAmountPaidDateOfPayment

  • 7/30/2019 Answer Ch02

    28/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    Owner and Service: Non-Identifying connection relationship, Owner may have from zero to

    many Services, Service must belong to exactly one Owner, HasPerformed/PerformedFor

    C. Combine your answers to questions A and B by naming the entity for services that arerecurring as RECURRING_SERVICE, naming the entity for services that are non-recurring as NON_RECURRING_SERVICE, and creating a new generic entity calledSERVICE that has RECURRING_SERVICE and NON_RECURRING_SERVICE ascategory entities. Create an IDEF1X model: state the type of all relationships, give thecardinalities, and name each relationship.

    Owner and Service: Non-Identifying connection relationship, Owner may have from zero to

    many Services, Service must belong to exactly one Owner, HasPerformed/PerformedFor

    Service, Non-Recurring_Service, Recurring_Service: Categorization Relationship, A Service

    must be either Non_recurring or Recurring but not both, each Non_Recurring and Recurring

    subtype must belong to exactly one service.

    D. Add an entity called CHIP_DELIVERY to your model in question C. To begin, assumethat none of Samanthas trimming customers ever buy chips. Create a new entitycalled CHIP_CUSTOMER for chip deliveries. Create an IDEF1X model: state the typeof all relationships, give the cardinalities, and name each relationship.

    2-28

    PhoneOwnerNameStreetCity

    StateZip

    OWNER SERVICE

    DateOfServiceDescription

    AmountBilledAmountPaid

    DateOfPayment

    PhoneOwnerNameStreetCityStateZip

    OWNER SERVICE

    DateOfServiceAmountBilledAmountPaidDateOfPayment

    Description

    NON_RECURRING_SERVICE RECURRING SERVICE

    DescriptionMonthsBetweenServiceServiceFee

    ZZ

    Z

  • 7/30/2019 Answer Ch02

    29/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    In this case there would be no new relationships. Chip_Delivery is not related to Customer

    because Customers do not buy chips. Chip_Delivery is not a category entity because it is not aService. The primary reason for not making Chip_Delivery a Service is that a service must

    belong to a Customer and the Chip_Delivery does not.

    E. Answer question D, but assume that some of her trimming customers can also buychips. Use category entities to model the types of customers similar to that in questionC. Create an IDEF1X model: state the type of all relationships, give the cardinalities,

    and name each relationship.

    2-29

    PhoneOwnerNameStreetCity

    StateZip

    OWNER SERVICE

    DateOfServiceAmountBilledAmountPaidDateOfPayment

    Description

    NON_RECURRING_SERVICE RECURRING SERVICE

    DescriptionMonthsBetweenServiceServiceFee

    ZZ

    Z

    PhoneCustomerNameStreetCityStateZipDateDeliveredLoadSize

    AmountBilledAmounPaid

    CHIP_DELIVERY

    PhoneOwnerNameStreetCityStateZip

    OWNER SERVICE

    DateOfServiceAmountBilledAmountPaidDateOfPayment

    Description

    NON_RECURRING_SERVICE RECURRING SERVICE

    DescriptionMonthsBetweenServiceServiceFee

    ZZ

    Z

    DateDeliveredLoadSize

    AmountBilledAmounPaid

    CHIP_CUSTOMERZ

  • 7/30/2019 Answer Ch02

    30/30

    Chapter Two Entity-Relationship Data Modeling: Tools and Techniques

    In this case I would use only one category entity and use an incomplete categorization

    relationship. The rationale is that not all Customers buy Chips but there are no additional

    attributes about those that do not buy chips. All Chip_Customers must be Customers but not all

    Customers are Chip_Buyers. All other relationships are the same as those in D above.