Docsity

Association Pattern in Table Intersection | CSIS 350, Study notes of Database Management Systems (DBMS)

Toggle sidebar
bg1
CSIS 350 โ€“ Lecture 18
Announcements
Next 2 homework assignments on course web site.
Read chapter 6, pages 194 - 212.
Tech-House blurb!
Chapter 6
Last time we began looking at the process for converting the E-R data model into a
relational DB design.
See slide 1
We discussed step 1, and examined step 2 for Strong entity relationships.
ID-dependent entities
Four uses of ID-dependent entities:
1) Representing N:M relationships
2) Association Relationships
3) Multivalued Relationships
4) Archetype/Instance Relationships
We saw number 1 last time (see slide 2).
Recall that the association pattern is very similar to the N:M strong entity pattern โ€“ the
difference between them is that in the association pattern there is data that is part of the
association instead of one of the entities (Example was price quote for parts from
supplicrs โ€“ see slide 3).
Slide 4 โ€“ this shows the tables and keys. Note that the association table contains a value
in addition to the foreign keys.
Intersection Table (from N:M strong entity relationship)
- contains only foreign keys as a composite primary key
- does not contain any user data
Association Table (from Association Pattern)
- contains composite key consisting of foreign keys
- includes user data
Note that the need for an association table appears in the user data โ€“ some form or report
will show the data that is part of the association of two entities. The user forms do not
pf3
pf4

Partial preview of the text

Download Association Pattern in Table Intersection | CSIS 350 and more Study notes Database Management Systems (DBMS) in PDF only on Docsity!

CSIS 350 โ€“ Lecture 18

Announcements Next 2 homework assignments on course web site. Read chapter 6, pages 194 - 212. Tech-House blurb! Chapter 6 Last time we began looking at the process for converting the E-R data model into a relational DB design. See slide 1 We discussed step 1, and examined step 2 for Strong entity relationships. ID-dependent entities Four uses of ID-dependent entities: 1) Representing N:M relationships 2) Association Relationships 3) Multivalued Relationships 4) Archetype/Instance Relationships We saw number 1 last time ( see slide 2 ). Recall that the association pattern is very similar to the N:M strong entity pattern โ€“ the difference between them is that in the association pattern there is data that is part of the association instead of one of the entities (Example was price quote for parts from supplicrs โ€“ see slide 3 ). Slide 4 โ€“ this shows the tables and keys. Note that the association table contains a value in addition to the foreign keys. Intersection Table (from N:M strong entity relationship)

  • contains only foreign keys as a composite primary key
  • does not contain any user data Association Table (from Association Pattern)
  • contains composite key consisting of foreign keys
  • includes user data Note that the need for an association table appears in the user data โ€“ some form or report will show the data that is part of the association of two entities. The user forms do not

indicate the need for an intersection table โ€“ it arises solely because of an M:N relationship between two strong entities. Association tables can connect more than two entity types. See slides 5 and 6. Multivalued Attributes In general, these are very simple to convert from the E-R model to the DB design. Make a table for each MV entity. See slide 7. Archetype/Instance Pattern An ID-dependent archetype instance pattern converts directly to the DB design โ€“ see slide 8. Remember that sometimes the instance has its own identifier instead of being ID- dependent on the archetype. Example: class and section with CRN number. In this case, the instance is a weak, but not ID-dependent entity. To convert this to a DB design, we need to put the primary key of the archetype into the instance as a FK โ€“ see slide 9. Mixed Entity Relationships (Line Item) Here, we use a combination of the design techniques we've already seen. Let's look at the orderLine entity in slide 10. Note that it is ID-dependent on sales order, but not on Item. What do we need to do to convert this to a database design? See slide 11 โ€“ add primary key of item to orderLine as a FK. Slide 12 shows the model and the design together. Subtype Relationships This one is also easy. Remember that a subtype relation is called an 'is-a' relation: a manager is-a employee, or a part-time teacher is-a teacher. What does this mean about the key used for the super- and sub-type tables? Both use the same key! See slide 13. Note that we don't have a way to distinguish the discriminator in the DB design โ€“ this needs to be documented elsewhere to indicate that the EmpCode field is used to determine the subtype of a given employee. Recursive Relationships

In-Class Exercise Do the Marcia's Dry Cleaning project at the end of chapter 6. Convert the E-R diagram below into your database design.

  • Use the notation of figure 6.6 to describe the data type and null status of each column, along with the public, foreign, and alternate keys.
  • Use a separate table (similar to figure 6.7) to document any default values.
  • Use a separate table to document domain, range, or intra-relation data constraints.
  • Don't worry about minimum cardinality and required children.