Your Federal Quarterly Tax Payments are due April 15th Get Help Now >>

Chapter 11 _I_ by dffhrtcv3


									Chapter 11 (I)


 Sungchul Hong
     Chapter 11 - Objectives
• How to use Entity–Relationship (ER) modelling
  in database design.
• Basic concepts associated with ER model.
• Diagrammatic technique for displaying ER
  model using Unified Modelling Language
• How to identify and resolve problems with ER
  models called connection traps.
• How to build an ER model from a requirements
    Entity-Relationship Model
• ER modeling is a top-down approach to
  database design.
• Unified Modeling Language
ER Diagram of Branch View of
  Concepts of the ER Model
• Entity types

• Relationship types

• Attributes
                Entity Type
• Entity type
  – Group of objects with same properties,
    identified by enterprise as having an
    independent existence.

• Entity occurrence
  – Uniquely identifiable object of an entity type.
Entity Type & Entity Occurrence

   Employee         Company
Examples of Entity Types
ER Diagram of Staff and Branch
         Entity Types
               Entities (EX)
• A college is divided into several schools.
• Each school is administered by a dean.
• A dean is a professor
• Each school is composed of several
• Each department offers several courses.
• A course can have many sections
• Each professor may teach up to four classes,
  each one a section of a course. A professor
  may also be on a research contract and teach
  no classes at all.
        Relationship Types
• Relationship type
  – Set of meaningful associations among entity

• Relationship occurrence
  – Uniquely identifiable association, which
    includes one occurrence from each
    participating entity type.
Semantic Net of Has
 Relationship Type

Branch has staff
ER Diagram of Branch Has Staff
         Relationship Types
• Degree of a Relationship
  – Number of participating entities in relationship.

• Relationship of degree:
  – two is binary;
  – three is ternary;
  – four is quaternary.
Binary Relationship called
Ternary Relationship called
• Can three binary relationships substitute a
  ternary relationship? (In general)
Quaternary Relationship called
         Relationship Types
• Recursive Relationship
  – Relationship type where same entity type
    participates more than once in different roles.

• Relationships may be given role names to
  indicate purpose that each participating
  entity type plays in a relationship.
Recursive Relationship called
 Supervises with Role Names
Entities associated through two distinct
    Relationships with Role Names
• Attribute
  – Property of an entity or a relationship type.

• Attribute Domain
  – Set of allowable values for one or more
• Simple Attribute
  – Attribute composed of a single component
    with an independent existence.

• Composite Attribute
  – Attribute composed of multiple components,
    each with an independent existence.
• Single-valued Attribute
  – Attribute that holds a single value for each
    occurrence of an entity type.

• Multi-valued Attribute
  – Attribute that holds multiple values for each
    occurrence of an entity type.
• Derived Attribute
  – Attribute that represents a value that is
    derivable from value of a related attribute,
    or set of attributes, not necessarily in the
    same entity type.
Registration(RegistrationNumber, State), VehicleID, Make, Model, Year, (Color)

   ((ABC 123, TEXAS), TK629, Ford Mustang, convertible, 1999, (red, black))
     ((ABC 123, NEW YORK), WP9872, Nissan 300ZX, 2-door, 2002, (blue))
     ((VSY 720, TEXAS), TD729, Buick LeSabre, 4-door, 2003, (white, blue))
• Candidate Key
  – Minimal set of attributes that uniquely
    identifies each occurrence of an entity type.

• Primary Key
  – Candidate key selected to uniquely identify
    each occurrence of an entity type.

• Composite Key
  – A candidate key that consists of two or more
          Primary Key (EX)
• staffNo, name, position salary, totalStaff
• branchNo, address {street, city, zip code,
  telephone number[1..3]}
• Patient number, patient name, drug
  number, drug name, description, dosage,
  method of admin, units per day, start date,
  finish date.
ER Diagram of Staff and Branch Entities
         and their Attributes
                Entity Type
• Strong Entity Type
  – Entity type that is not existence-dependent
    on some other entity type.

• Weak Entity Type
  – Entity type that is existence-dependent on
    some other entity type.
Strong Entity Type called Client and Weak
      Entity Type called Preference
Relationship called Advertises
       with Attributes

                   N   P   D   C
                   N1 P1 1     10
                   N1 P2 1     10
                   N2 P1 1     20

To top