coop-1 cardinalities solution package. problem #2 group _______ problem #2 group _______ problem #1...

18
COOP-1 CARDINALITIES SOLUTION PACKAGE

Upload: samantha-warner

Post on 05-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

COOP-1 CARDINALITIES

SOLUTIONPACKAGE

Page 2: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Problem #2 Group _______Problem #2 Group _______Problem #1

Person

Min Max Min Max

has_as_favorite

Jimmy (a person) doesn’t care about music and does not have a favorite musician (We still need to record Jimmy in our database).

Only one favorite musician can be recorded for a person.We have recorded more than thousand musicians in our database

Many people have Neil Young as their favorite musician Unfortunately, no one has selected Freddy Fender (one of the musicians in our database)

as their favorite musician.

Musician

Page 3: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Problem #2 Group _______Problem #2Problem #1 -- Solution

Person

0

Min

1

Max

0

Min

N

Max

has_as_favorite

Jimmy (a person) doesn’t care about music and does not have a favorite musician (We still need to record Jimmy in our database).

Only one favorite musician can be recorded for a person.We have recorded more than thousand musicians in our database

Many people have Neil Young as their favorite musician Unfortunately, no one has selected Freddy Fender (one of the musicians in our database)

as their favorite musician.

Musician

Page 4: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Parent Child

Group _______Problem #2

Min Max Min Max

Page 5: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Parent Child

Problem #2

1. Being a parent implies that you have one or more children.2. All children have 2 parents.

Page 6: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Parent Child

Problem #2 -- Solution

1

Min

N

Max

1

Min

N

Max

1. Being a parent implies that you have one or more children.

2. All children have 2 parents.

Page 7: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Car Order

Sale(shipment)

Purchase(Deliver)

Min

Max

Min

Min

Group _______Problem #3

1. We always have open orders – i.e., orders that have not been fulfilled yet.2. A car can only be sold once.

3. We have some cars in inventory – i.e., cars we have bought (purchased) but that have not been sold yet.

4. We buy cars exclusively – i.e., at least one car needs to be recorded for each purchase.

Page 8: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Car Order

Sale(shipment)

Purchase(Deliver)

0

Min

1

Max

1. We always have open orders – i.e., orders that have not been fulfilled yet.2. A car can only be sold once.

3. We have some cars in inventory – i.e., cars we have bought (purchased) but that have not been sold yet.

4. We buy cars exclusively – i.e., at least one car needs to be recorded for each purchase.

0

Min

1

Min

Problem #3 -- Solution

Page 9: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Group _______Problem #5

Purchase/Delivery

CashDisbursement

Group _______Problem #4 -- Assignment Max Min MaxMin

Labor Service

Here are our payment policies:

1. We usually pay our vendors no later than 60 days after delivery.

2. We often pay our vendors in installments.3. Some of our cash disbursements (checks) pay for deliveries

(by vendors). Some of our cash disbursements (checks) pay for labor services (by employees).

4. The same cash disbursement can pay for multiple deliveries.

Page 10: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Group _______Problem #5

Purchase/Delivery

CashDisbursement

Here are our payment policies:

1. We usually pay our vendors no later than 60 days after delivery.

2. We often pay our vendors in installments.3. Some of our cash disbursements (checks) pay for deliveries

(by vendors). Some of our cash disbursements (checks) pay for labor services (by employees).

4. The same cash disbursement can pay for multiple deliveries.

Problem #4 -- Solution

N

Max

0

Min

N

Max

0

Min

Labor Service

Page 11: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Monica owes a store that sells stuffed animals. She records all her customers and items (stuffed animals) in a database. She

currently has more than 350 customers; all of them are recorded in the database. She currently sells 486 different items; all of them are recorded in the database. Further, for her 25 most important customers (“Club 25”) she keeps a list of their 5

favorite items. She uses that information to send gifts (birthday, wedding, etc.). An item can be the favorite item for more than

one “Club 25” member.

Customer Item

Min Max Min Max

Club 25

Group _______Problem #5

Page 12: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Problem #5 – Solution

Monica has a store that sells stuffed animals. She records all her customers and items (stuffed animals) in a database. She

currently has more than 350 customers; all of them are recorded in the database. She currently sells 486 different items; all of them are recorded in the database. Further, for her 25 most important customers (“Club 25”) she keeps a list of their 5

favorite items. She uses that information to send gifts (birthday, wedding, etc.). An item can be the favorite item for more than

one “Club 25” member.

Customer Item

0

Min

N

Max

0

Min

N

Max

Club 25

Page 13: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Group _______Problem #8

Some employees supervise projects exclusively; i.e. they don’t work on any project. Most of our employees do not supervise projects; i.e. they only work on projects. John, one of our employees, currently works on five

different projects. Suzy, one of our employees, currently supervises two different projects. A project is supervised by one employee. We currently

have more than twenty employees working on one of our projects. We always assign the supervisor first. So it is possible to record a project’s supervisor in the database without knowing who (employees) is going to work on the project. It is impossible to record a project into our database

without recording a supervisor at the same time; i.e., a project must have a supervisor.

Group _______Problem #6Define the cardinalities

PROJECT

works-on

supervises

MIN

MAX

MAX

MIN

MIN

MAX

MAX

MIN

EMPLOYEE

Page 14: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Group _______Problem #8

Some employees supervise projects exclusively; i.e. they don’t work on any project. Most of our employees do not supervise projects; i.e. they only work on projects. John, one of our employees, currently works on five

different projects. Suzy, one of our employees, currently supervises two different projects. A project is supervised by one employee. We currently

have more than twenty employees working on one of our projects. We always assign the supervisor first. So it is possible to record a project’s supervisor in the database without knowing who (employees) is going to work on the project. It is impossible to record a project into our database

without recording a supervisor at the same time; i.e., a project must have a supervisor.

Problem #6 -- SolutionDefine the cardinalities

PROJECT

works-on

supervises

N

0MIN

MAX

0

NMAX

MIN

MIN

MAXN

0

1

1 MAX

MIN

EMPLOYEE

Page 15: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Some of our locations, such as our warehouses, are further divided. For example, a warehouse is divided in areas, and each area is then further divided into bins. One of our warehouses is

divided into twenty areas. Bins are never further divided. A location belongs to at most one other location. Obviously,

warehouses do not belong to any other location.Warehouse, area, and bin are all instances of location.

Problem #7 -- Assignment

Location

MaxMin MaxMin

Page 16: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Problem #7 -- Assignment With Role Names

Location

DIVIDED IN BELONGS TO

Some of our locations, such as our warehouses, are further divided. For example, a warehouse is divided in areas, and each area is then further divided into bins. One of our warehouses is

divided into twenty areas. Bins are never further divided. A location belongs to at most one other location. Obviously,

warehouses do not belong to any other location.Warehouse, area, and bin are all instances of location.

MaxMin MaxMin

Page 17: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

Problem #7 -- Solution

Location

DIVIDED IN BELONGS TO

Some of our locations, such as our warehouses, are further divided. For example, a warehouse is divided in areas, and each area is then further divided into bins. One of our warehouses is

divided into twenty areas. Bins are never further divided. A location belongs to at most one other location. Obviously,

warehouses do not belong to any other location.Warehouse, area, and bin are all instances of location.

N

Max

0

Min

1

Max

0

Min

Page 18: COOP-1 CARDINALITIES SOLUTION PACKAGE. Problem #2 Group _______ Problem #2 Group _______ Problem #1 Person MinMaxMinMax has_as_favorite  Jimmy (a person)

WAREHOUSE-1

AREA-1A

AREA-1B

BIN-1AA BIN-1AB BIN-1AC

BIN-1BA BIN-1BB

WAREHOUSE-1

AREA-1A AREA-1B

BIN-1AA

BIN-1AB

BIN-1AC

BIN-1BA

BIN-1BB

DIV

IDE

D-I

N

BE

LO

NG

S-T

O