dd_s05_l03.pdf

12
Copyright © 2008, Oracle. All rights reserved. Resolving Many-to-Many Relationships

Upload: mazmoh

Post on 12-Apr-2015

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: dd_s05_l03.pdf

Copyright © 2008, Oracle. All rights reserved.

Resolving Many-to-Many Relationships

Page 2: dd_s05_l03.pdf

2

Resolving Many-to-Many Relationships

Copyright © 2008, Oracle. All rights reserved.

What Will I Learn?In this lesson, you will learn to:

• Identify attributes which belong to many-to- many relationships

• Demonstrate the steps to resolve a many- to-many relationship using an intersection entity

• Identify the UID of an intersection entity and represent it in the entity relationship diagram

Page 3: dd_s05_l03.pdf

3

Resolving Many-to-Many Relationships

Copyright © 2008, Oracle. All rights reserved.

Why Learn It?This lesson will help you complete your model -- you may need to create new entities or new relationships based on the business needs.

It will also help you define the scope of your data model -- you only model what is of importance to the business.

Page 4: dd_s05_l03.pdf

4

Resolving Many-to-Many Relationships

Copyright © 2008, Oracle. All rights reserved.

Tell Me / Show MeRelationship Hiding an Attribute

In the DJ business, each PARTNER may be assigned to work on one or more EVENTs. Each EVENT may be a job for one or more PARTNERs.

When an EVENT PLANNER, a DJ, or a PROJECT MANAGER works on an EVENT, we want them to record the status of the job.

Which entity would the attribute "status" belong to?

PARTNER# id* first name* last name

EVENT PLANNER* expertise

DJ* specialty

MANAGERo authorized

expense limit

EVENT# id* name* dateo description* cost

work on

worked on by

EVENT and PARTNER

Page 5: dd_s05_l03.pdf

5

Resolving Many-to-Many Relationships

Copyright © 2008, Oracle. All rights reserved.

Tell Me / Show MeResolution of a M:M Relationship

A third entity is needed to resolve the M:M relationship. This is called an "intersection" entity.

sdm_s05_l03_a01

Page 6: dd_s05_l03.pdf

6

Resolving Many-to-Many Relationships

Copyright © 2008, Oracle. All rights reserved.

Tell Me / Show Me

An intersection entity – JOB ASSIGNMENT – has been added, including the status attribute.

The original M:M relationship has become two 1:M relationships.

What would be the UID of the intersection entity?

PARTNER# id* first name* last name

EVENT PLANNER* expertise

DJ* specialty

MANAGERo authorized

expense limit

EVENT# id* name* dateo description* cost

JOB ASSIGNMENTo status

responsible for

the source of

for for

JOB ASSIGNMENT

Page 7: dd_s05_l03.pdf

7

Resolving Many-to-Many Relationships

Copyright © 2008, Oracle. All rights reserved.

Tell Me / Show MeBarred Relationships

The unique identifier (UID) of the intersection entity often comes from the originating relationships and is represented by the bars. In this case, the relationships from the originating entities to the intersection entity are called "barred" relationships.

PARTNER# id* first name* last name

EVENT PLANNER* expertise

DJ* specialty

MANAGERo authorized

expense limit

EVENT# id* name* dateo description* cost

JOB ASSIGNMENTo status

responsible for

the source of

for for

JOB ASSIGNMENT

Page 8: dd_s05_l03.pdf

8

Resolving Many-to-Many Relationships

Copyright © 2008, Oracle. All rights reserved.

Tell Me / Show MeM:M Resolution Example: TV Shows

Each TV show may be watched by one or more persons.

Each person may watch one or more TV shows.

TV SHOW PERSONwatched by

watch

Resolution of M:M

PERSONTV SHOW

VIEWINGRECORD

for for

on on

TV SHOW

Page 9: dd_s05_l03.pdf

9

Resolving Many-to-Many Relationships

Copyright © 2008, Oracle. All rights reserved.

Tell Me / Show MeM:M Resolution Example: Cleaning Services

Each company may provide one or more cleaning services.

Each cleaning service may be provided by one or more companies.

CLEANING COMPANY

CLEANING SERVICE

provide

provided by

Resolution of M:M

CLEANING COMPANY

CLEANING SERVICE

CLEANINGSCHEDULE

for for

on on

CLEANING SERVICES

Page 10: dd_s05_l03.pdf

10

Resolving Many-to-Many Relationships

Copyright © 2008, Oracle. All rights reserved.

Tell Me / Show MeTerminologyKey terms used in this lesson include:

Barred relationshipIntersection entity

Page 11: dd_s05_l03.pdf

11

Resolving Many-to-Many Relationships

Copyright © 2008, Oracle. All rights reserved.

SummaryIn this lesson, you have learned how to:

• Identify attributes which belong to many-to- many relationships

• Demonstrate the steps to resolve a many- to-many relationship using an intersection entity

• Identify the UID of an intersection entity and represent it in the entity relationship diagram

Page 12: dd_s05_l03.pdf

12

Resolving Many-to-Many Relationships

Copyright © 2008, Oracle. All rights reserved.

SummaryPractice Guide

The link for the lesson practice guide can be found in the course outline.

Summary