COM312 Assignment Database Design I
COM312 Assignment Database Design I
COM312 Assignment Database Design I
Database Systems
Entity Relationship Model
Objectives
The objective of this alternative to lab practical is to teach you how to use case software tool (TOAD Data
Modeler) to draw an Entity Relationship (ER) diagram, including different type of entities, attributes, and
relationships
Outcomes
you are expected to:
Be able to use case software tools to draw an ER diagram from a given specification (or problem
statement).
Be able to use some features of the software on representing the ER diagram as close as to the manual
(or standard) ER diagram notification.
Discussion
1. Introduction
The Entity-Relationship (ER) model is a high-level conceptual data model that is widely used in the design of
a database application. The ER model represents data in terms of:
Entities
Attributes of entities
Relationships between entities
There are several case tools to automate the drawing of diagram. Most of them have a feature of associating
the diagram with specific database. This feature makes it easy to further process in designing and
implementing to specific database.
To start creating an ER diagram on TOAD Data Modeler, select File New Model, then select target
database.
2. Entity
An entity is an object or a concept that is identified by the enterprise as having an independent existence,
i.e. EMPLOYEE, DEPARTMENT, etc. An Entity (or entity type) usually has an attribute whose value is distinct
for each individual entity in the collection. Such attribute is called a key attribute, i.e. SSN for EMPLOYEE
entity.
To create an entity, Click the Entity on the toolbar area, and then place it on the working area.
Entity Name
Entity Name Attribute
Attribute
Weak Entity (dependent entity): Entity that has no key attribute of its own.
Standard Notation TOAD Data Modeler Notation
Entity Name
Entity Name Attribute
Attribute
The TOAD will automatically change the notation from strong entity to weak entity for any entities that are
the child side of identifying relationship.
3. Attribute
Attributes are the information that explains the properties of an entity. To add (or create) attributes to
the entity, edit the entity by double-clicking the entity or right click and select Edit Entity. Select
Attribute tab on Entity window. Then click Add Button, to create attribute. The Attribute dialog will open.
Supply the name, type of attribute, and other attribute's properties as necessary.
Meanwhile, the attributes on standard ER diagram are represented in oval attached to the entity.
4. Relationship
Relationship (relationship type) is a meaningful association among entity types. Generally, a relationship is
represented as a connection between (or among) entities. In standard ER model, it uses a diamond shape to
connect between (or among) entities, while in TOAD, it does not use any intermediate notation. There are
several type of relationships based on the type, degree, cardinality, and participation.
Identifying
Binary
Cardinality
One-to-one 1 1
One-to-many
1 n
Many-to-Many
n m
Participation
Total
(Mandatory)
Partial
(Optional)
5. Example of ER Diagram
The simplified problem statement:
The Company assigns an employee to one department but may work on several projects, which are not
necessarily controlled by the same department. It keeps track of the number of hours per week that
an employee works on each project. It records the direct supervisor of each employee. It stores the
dependants of each employee for insurance purposes. It keeps each dependant’s: name, gender, birth
date, and relationship to employee
Assignment
1. Consider an online auction database system in which members (buyers and sellers) participate in the sale
of items. The data requirements for this system are summarized as follows:
• The online site has members who are identified by a unique member id and are described by an email
address, their name, a password, their home address, and a phone number.
• A member may be a buyer or a seller. A buyer has a shipping address recorded in the database. A
seller has a bank account number and routing number recorded in the database.
• Items are placed by a seller for sale and are identified by a unique item number assigned by the
system. Items are also described by an item title, an item description, a starting bid price, bidding
increment, the start date of the auction, and the end date of the auction.
• Items are also categorized based on a fixed classification hierarchy (for example a modem may be
classified as /COMPUTER/HARDWARE/MODEM).
• Buyers make bids for items they are interested in. A bidding price and time of bid placement is
recorded. The person at the end of the auction with the highest bid price is declared the winner
and a transaction between the buyer and the seller may proceed soon after.
• Buyers and sellers may place feedback ratings on the purchase or sale of an item. The feedback
contains a rating between 1 and 10 and a comment. Note that the ratings are placed on a completed
transaction by the buyer or seller of the item in the transaction.
Design an Entity-Relationship diagram for the auction database and enter the design using a data
modeling tool such as TOAD.
2. Consider a movie database in which data is recorded about the movie industry. The data requirements
are summarized as follows:
• Movies are identified by their title and year of release. They have a length in minutes. They also
have a studio that produces the movie and are classified under one or more genres (such as
horror, action, drama etc). Movies are directed by one or more directors and have one or more
actors acting in them. The movie also has a plot outline. Each movie also has zero or more
quotable quotes which are spoken by a particular actor acting in the movie.
• Actors are identified by their names and date of birth and act in one or more movies. Each actor
has a role in the movie.
• Directors are also identified by their names and date of birth and direct one or more movies. It is
possible for a director to act in a movie (not necessarily in a movie they direct).
• Studios are identified by their names and have an address. They produce one or more movies.
Design an Entity-Relationship diagram for the movie order database and enter the design using a
data modeling tool such as TOAD.