You are on page 1of 4

academy.oracle.

com

Database Design 9-3: Relationship


Mapping Practice Activities
Objectives
• Apply the rule of relationship mapping to correctly transform 1:M and barred
relationships
• Apply the rule of relationship mapping to correctly transform M:M relationships
• Transform 1:1 relationships
• Apply the rule of relationship mapping to correctly transform relationships in an arc

Vocabulary
Identify the vocabulary word for each definition below.
A relationship in a database where the foreign key column in the
database table cannot be updated

A series of relationships implying that the unique identifier of each entity


in the chain is carried down to the entity on the next level

The product of the resolution of a many to many relationship.

Try It / Solve It
The following entities were mapped to tables in a previous lesson: SHIFT, REGULAR MENU,
PROMOTIONAL MENU, FREQUENT DINER CARD.

Refer to the completed Global Fast Foods model and map the following entities:

FOOD ITEM
ORDER
ORDER LINE

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
1. Transform relationships into foreign-key columns.

 Use as many rows as necessary in a table similar to the one in the diagram.

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
FOOD ITEMS
Key Type Optionality (“*” or Column Name
( pk, uk, “o”)
fk)

PK * Food_ID
FK * RGR_ID
* Description
* Price

ORDERS
Key Type Optionality (“*” or Column Name
( pk, uk, “o”)
fk)

PK * Order_ID
FK * Prom_ID
FK * Staff_ID
* Date
* Time

Orders Lines
Key Type Optionality (“*” or Column Name
( pk, uk, “o”)
fk)

PK,FK * Order_ID
* QTY
FK * FDR_ID

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
2. Indicate if a check constraint or additional programming is needed to enforce the
relationship in the database. Under each table diagram, write the conditions that the check
constraint or program has to ensure.

For example:

“To enforce exclusive relationships, a check constraint is needed to make sure that
(column A is not null and column B is null) OR (column A is null and column B is not
null).”

“To enforce a nontransferable relationship, additional programming is needed to make


sure that the <foreign key column> cannot be updated.”

 additional programming is needed to ensure that the shift_id attribute cannot be


changed during the day or the next day

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.

You might also like