Oracle Designer Tutorial


Prev Next

Lesson 2
Create entities and add relationships

Any application you develop will store and manipulate information, so an essential part of developing a system is constructing an accurate model of the information needs of an organization. The information model will act as a framework for the development of new or enhanced systems.

One technique used to model an organization’s information requirements is entity relationship modeling. Entity relationship modeling involves identifying the things of importance in an organization (entities), the properties of those things (attributes) and how they are related to one another (relationships).

The Entity Relationship Diagrammer, one of the Oracle Designer tools, enables you to create an entity relationship model in the form of a diagram showing the elements of information and the way they are logically related.

An entity relationship diagram has already been created for Speedy Pizza, modeling the information needs of the business. During this lesson, you will:

Create an entity

An entity is a thing of significance, whether real or conceptual, about which the business being modeled needs to hold information.

Objective

To add an entity representing PRODUCT to the entity relationship diagram modeling the order processing area of the business.

Instructions

  1. Click on the Entity Relationship Diagrammer button on the Oracle Designer Window to start the Entity Relationship Diagrammer.

    Entity Relationship icon

  2. Select Filearrow.gif (182 bytes)Open to display the Open Diagram dialog box.

    Open Diagram dialog box

  3. Click on the plus symbol to expand the list, then double click on SPEEDY PIZZA - ERD1 to open the diagram.

    entity relationship diagram

    Hint: You might have to resize the window to view all the entities.

  4. Click on the (create) Entity toolbar button.

    Entity toolbar button

  5. Move the mouse pointer to below the PRICED PRODUCT entity and click to create the entity.

    The Create Entity dialog box appears.

    Create Entity dialog box

  6. Enter the following details in the Create Entity dialog box:

    Name: PRODUCT

    Short Name: PDT

    Plural: PRODUCTS

  7. Click on OK to close the Create Entity dialog box.

    The PRODUCT entity appears on the diagram.

    ERD with PRODUCT entity

    Hint: You might have to resize the PRODUCT entity.

Add a relationship

Relationships are named significant associations between two entities. Relationships on an entity relationship diagram display graphical indications of their optionality (whether a relationship is mandatory or optional) and cardinality (the number at each end of a relationship).

Objective

To create a relationship between the PRICED PRODUCT entity and the PRODUCT entity.

Instructions

  1. Click on the Many-to-One (Mandatory to Optional) Relationship toolbar button.

    M:1 (M to O) Relationship toolbar button

    Note: It is important to click on the correct toolbar button. Check that the tooltip is "M:1 (M to O) Relationship" and that the text in the status bar is "Creates a M:1 (mandatory to optional) relationship".

  2. Click on the PRICED PRODUCT entity.

    A line starts from the edge of the entity that you clicked on and stretches to wherever you move the mouse pointer.

  3. Click on the PRODUCT entity.

    A line appears between the PRICED PRODUCT entity and the PRODUCT entity, and the Create Relationship dialog box appears.

    Create Relationship dialog box

  4. In the Create Relationship dialog box, enter the following details:

    From Name: FOR

    To Name: OBTAINABLE AS

  5. Click on OK to close the Create Relationship dialog box.

    The names of the two ends of the relationship appear on the entity relationship diagram.

    ERD with new relationship

  6. Select Filearrow.gif (182 bytes)Save Diagram to save the entity relationship diagram.

Create attributes

An attribute is any detail that serves to qualify, identify, classify, quantify or express the state of an entity.

A unique identifier is a combination of attributes and/or relationships that uniquely identifies an occurrence of an entity.

Objective

To add attributes to the new PRODUCT entity.

Instructions

  1. Double click on the PRODUCT entity to display the Edit Entity dialog box.

    Edit Entity dialog box

    You are now ready to enter the attributes of the PRODUCT entity.

    If a particular attribute is always required, the attribute is described as mandatory. If the attribute has a value for only some of the time, it is described as optional. An attribute’s Optionality (Opt) property specifies whether the attribute is mandatory or optional.

    The type of data represented by an attribute is defined by the attribute’s Format property. Some attribute formats require further definition, including length and the number of decimal places (specified by the Max Len and Dec properties respectively).

    Attributes can be associated with a domain (a common set of properties that apply to a group of attributes).

  2. On the Attributes tab, enter the following details:

    Name

    Seq

    Opt

    Format

    MaxLen

    Dec

    Primary

    DISCOUNT DAY

     

    þ

    CHAR

    1

     

     

    PRODUCT DESCRIPTION

     

     

    VARCHAR2

    30

     

     

    PRODUCT ID

     

     

    INTEGER

    6

     

    þ

    PRODUCT TYPE

     

     

    VARCHAR2

    10

     

     

    Hint: Use the horizontal scroll bar to see the Format, Max Len, Dec and Primary fields.

  3. Double check that you have entered all of the attribute details correctly (this is important for the rest of the tutorial).

    Each occurrence of an entity can be uniquely identified by one or more of its attributes. Because you have checked Primary against PRODUCT ID, that attribute will be used as the unique identifier (UID). You can confirm this on the UIDs tab. You could also use the UIDs tab to change the composition of the UID or to create alternate UIDs. For this tutorial, we will not make these changes.

  4. Click on OK to close the Edit Entity dialog box.

    The attributes for the PRODUCT entity are displayed on the diagram.

    ERD showing new entity with attributes

    Hint: You might have to resize the PRODUCT entity to see all the attributes.

  5. Select Filearrow.gif (182 bytes)Save Diagram, then select Filearrow.gif (182 bytes)Exit to close the Entity Relationship Diagrammer.


Lesson summary

In this lesson you used the Entity Relationship Diagrammer to enter a new entity, PRODUCT. You specified the relationship between the PRODUCT entity and the PRICED PRODUCT entity. You defined the attributes of the PRODUCT entity.



Next

Prev

Next

oracle.gif (1205 bytes) 
Copyright © 2000 Oracle Corporation.  
All Rights Reserved.