You are on page 1of 10

ER Diagramming Conventions

Relationship Basics
Objectives

Construct ER diagram
components that represent
ER Diagramming

entities, attributes and


Conventions

relationships according to
diagramming conventions

OEHB
Purpose

People speak
different languages
ER Diagramming

throughout the
world, but some
Conventions

signs are
understood globally.

OEHB
Shared Convention

It is efficient to communicate
information in a way that can
be easily understood by many
people.
ER Diagramming

ER diagramming is like that


Conventions

• you may say or write things differently


because of the way you speak, your
accent, and so on, but
• everyone draws ER diagrams according
to the same conventions.

OEHB
Case: HR System: EMPLOYEEs, JOBs, and DEPARTMENTs

“We need to store data about each of our company’s employees. We need to track each employee's first name, last
name, hire date and salary. For each employee on commission, we also need to track his/her potential commission.”

“Each employee is allocated a unique employee number.”


ER Diagramming

“Our company is divided into departments. Each employee reports to a department - for example,
accounting, sales, or development.”
Conventions

“We need to know the department responsible for each employee. Each department has a unique number.”

“All employees hold a job, and we keep track of the job title, max and min salary for each job. Every job has a
unique job id.”

OEHB
ER Drawing Conventions

Entities are
represented by
softboxes.
ER Diagramming

Entity names go
in the softboxes.
Conventions

Entity names are


always singular
and written with
all capital letters.

OEHB
Drawing Conventions

Mandatory
Attributes are
attributes are
listed under the
marked with an
ER Diagramming

entity names.
asterisk: “*”
Conventions

Optional Unique
attributes are identifiers are
marked with a marked with a
circle: “o” hash sign: “#”

OEHB
Drawing Conventions

Relationships are lines These lines are either


that connect entities. solid or dashed.
ER Diagramming
Conventions

These lines terminate


in either a “single You will learn the
specific details about
toe” or a “crow’s
relationship lines in the
foot” at the end of
next lesson.
each entity.

OEHB
Practice
Draw the entities.
List the attributes underneath each entity.
Specify whether they are mandatory or optional.
Identify the UIDs.
Write out the relationship in English, including optionality and cardinality.

} “In our salon, we have a number of hairstylists. } “I am an agent for several musicians and bands. A
They are all salaried employees, so we keep a record musician may be a solo performer or may belong to
of their first name, last name, address, phone a band. A band will always have one or more
ER Diagramming

number, social-security num- ber, and salary. During musicians in it. Some musi- cians are a one-man
the course of a day, a hairstylist may see several band. However, a musician can belong to only one
clients. On a slow day, a hairstylist may not work on band. Since I schedule them for concerts and events,
anyone at all. We have several walk-in clients, and I need to keep track of certain information: the
Conventions

they each get assigned to one hairstylist. We just ask musician’s first name, last name, address, phone
for their first name. We also have customers who number, and hourly rate. If it’s a band, I need to
call to make an appointment. When they do this, we know the band name in addition to the information I
ask for their first name, last name, and phone already keep for the member musicians. I’ve handled
number. We also ask if they would like a specific bands with the same name, so just to make sure I
hairstylist. If they have no preference, we assign one book the right band, I assign an ID to each one. The
for them. Of course, they are allowed to switch to hourly rate for a band is the total of the hourly
another hairstylist for their next visit to the salon. rates of its members.”
We are interested in tracking the daily appointments
-- which stylist works on which client during a given
day.”

OEHB
Practice
Draw the entities.
List the attributes underneath each entity.
Specify whether they are mandatory or optional.
Identify the UIDs.
Write out the relationship in English, including optionality and cardinality.

} “We have several teachers at our school. } “Our school offers many courses -- such as
A teacher can be assigned up to three } Data Modeling,
Introduction to SQL,
classes per semester. If a teacher is on }
ER Diagramming

} Trigo- nometry,
sabbatical, he doesn’t teach that semester. } Physics, and
We keep a record of the teacher’s first } Biology.
name, last name, address, phone number,
Conventions

} Each course has a code. For example:


and email address.” } Data Modeling would be DM001,
} Trigonometry would be TR004, etc.
} During each semester, a course may be taught in several
classes -- so there could be two classes of
} Physics, three clas- ses of Biology, etc.
} Each class can be taught by only one teacher. We assign a
unique ID for each class, and we also keep track of the day it is
taught, the time, and the classroom.”

OEHB

You might also like