100% found this document useful (1 vote)
554 views

Notes and Exercises On ERD

The document discusses conceptual and relational models, specifically entity relationship diagrams (ERDs). It defines the key components of an ERD including entities, attributes, relationships, and cardinality. It provides examples of common ERD symbols and outlines best practices for constructing an ERD such as identifying entities and relationships and adding attributes. Finally, it discusses mapping an ERD to relational tables and the steps of normalization.

Uploaded by

Hildana Tamrat
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
554 views

Notes and Exercises On ERD

The document discusses conceptual and relational models, specifically entity relationship diagrams (ERDs). It defines the key components of an ERD including entities, attributes, relationships, and cardinality. It provides examples of common ERD symbols and outlines best practices for constructing an ERD such as identifying entities and relationships and adding attributes. Finally, it discusses mapping an ERD to relational tables and the steps of normalization.

Uploaded by

Hildana Tamrat
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Conceptual and relational model

What is an Entity Relationship Diagram (ERD)?


An entity relationship diagram (ERD) shows the relationships of entity sets stored in a database.
An entity in this context is a component of data. In other words, ER diagrams illustrate the logical
structure of databases.

Common Entity Relationship Diagram Symbols


An ER diagram is a means of visualizing how the information a system produces is related.
There are five main components of an ERD:
 Entities, which are represented by rectangles. An entity is an object or concept about

which you want to store information.


A weak entity is an entity that must defined by a foreign key relationship with another

entity as it cannot be uniquely identified by its own attributes alone.


 Actions, which are represented by diamond shapes, show how two entities share

information in the database.


 In some cases, entities can be self-linked. For example, employees can supervise other
employees.

 Attributes, which are represented by ovals. A key attribute is the unique, distinguishing
characteristic of the entity. For example, an employee's social security number might be
the employee's key attribute.

 A multivalued attribute can have more than one value. For example, an employee entity

can have multiple skill values.


 A derived attribute is based on another attribute. For example, an employee's monthly

salary is based on the employee's annual salary.


 Connecting lines, solid lines that connect attributes to show the relationships of entities
in the diagram.
 Cardinality specifies how many instances of an entity relate to one instance of another
entity. Ordinality is also closely linked to cardinality. While cardinality specifies the
occurrences of a relationship, ordinality describes the relationship as either mandatory or
optional. In other words, cardinality specifies the maximum number of relationships and
ordinality specifies the absolute minimum number of relationships.

There are many notation styles that express cardinality.


Information Engineering Style
Entity Relationship Diagram steps
Here are some best practice tips for constructing an ERD:

 Identify the entities. The first step in making an ERD is to identify all of the entities you
will use. An entity is nothing more than a rectangle with a description of something that
your system stores information about. This could be a customer, a manager, an invoice,
a schedule, etc. Draw a rectangle for each entity you can think of on your page. Keep
them spaced out a bit.

 Identify relationships. Look at two entities, are they related? If so draw a solid line
connecting the two entities.
 Describe the relationship. How are the entities related? Draw an action diamond
between the two entities on the line you just added. In the diamond write a brief
description of how they are related.
 Add attributes. Any key attributes of entities should be added using oval-shaped
symbols.
 Complete the diagram. Continue to connect the entities with lines, and adding diamonds
to describe each relationship until all relationships have been described. Each of your
entities may not have any relationships, some may have multiple relationships. That is
okay.
 Example to illustrate the major rules in mapping ER to relational
schema:
 The following ER has been designed to represent the requirement of an organization to capture
Employee Department and Project information. And Employee works for department where an
employee might be assigned to manage a department. Employees might participate on different
projects within the organization. An employee might as well be assigned to lead a project where
the starting and ending date of his/her project leadership and bonus will be registered.
After we have drawn the ER diagram, the next thing is to map the ER into relational schema so as the
rules of the relational data model can be tested for each relational schema. The mapping can be done
for the entities followed by relationships based on the rule of mapping. the mapping has been done
as follows.



Steps of Normalization:
First Normal Form (1NF)
Requires that all column values in a table are atomic (e.g., a number is an atomic value, while a
list or a set is not).
Putting each repeating group into a separate table and connecting them with a primary key-
foreign key relationship

Exercises
Draw ERD for the following cases and map the ERD in to Relation
1. An internet sales organization takes items produced by different companies and sells the items
to customers based on their order.
2. In a hospital system, a patient undergoes procedures based on the order of the doctor. A
procedure has a code and fee. A patient has personal details and medical details. A doctor has
name and specialty.
3. A writer writes books and customers buy it.
4. Exam attendees choose from number of exams from and exam management system and sit for
an exam. After the examination is done, the record number, exam subject, name and score is
automatically recorded in the database.
5. A student record management system will have the following two basic data object categories
with their own features or properties: Students will have an Id, Name, Dept, Age, GPA and Course
will have an Id, Name, Credit Hours. Whenever a student enroll in a course in a specific Academic
Year and Semester, the Student will have a grade for the course.
6. A Personnel record management system will have the following two basic data object categories
with their own features or properties: Employee will have an Id, Name, DoB, Age, Tel and
Department will have an Id, Name, Location. Whenever an Employee is assigned in one
Department, the duration of his stay in the respective department should be registered.
7. And Employee works for department where an employee might be assigned to manage a
department. Employees might participate on different projects within the organization. An
employee might as well be assigned to lead a project where the starting and ending date of his/her
project leadership and bonus will be registered.
8. Consider the following set of requirements for a university database that is used to keep track of
students’ transcripts.
 The university keeps track of each student’s name, student number, social security number,
current address and phone, permanent address and phone, birthdate, sex, class (freshman,
sophomore, . . ., graduate), major department, minor department (if any), and degree program
(B.A., B.S., . . ., Ph.D.). Some user applications need to refer to the city, state, and zip code of the
student’s permanent address and to the student’s last name. Both social security number and
student number have unique values for each student.
 Each department is described by a name, department code, office number, office phone, and
college. Both name and code have unique values for each department.
 Each course has a course name, description, course number, number of semester hours, level,
and offering department. The value of course number is unique for each course.
 Each section has an instructor, semester, year, course, and section number. The section number
distinguishes sections of the same course that are taught during the same semester/year; its
values are 1, 2, 3, . . ., up to the number of sections taught during each semester.
 A grade report has a student, section, letter grade, and numeric grade (0, 1, 2, 3, or 4).
9. Normalize the following table in to first normal form
Employee Age Department
Melvin 32 Marketing, Sales
Edward 45 Quality Assurance
Alex 36 Human Resource

10. Normalize the following table in to 2nd normal form

productID product Brand Brand address


1 Monitor Apple USA
2 Monitor Samsung S.Korea
3 Scanner HP USA
4 Head phone JBL Japan
11. Normalize the following tables in to 2nd normal form
| Name | Age | Pet | Pet Name |
----------------------------------------------
| Heather | 10 | Dog | Rex |
----------------------------------------------
| Heather | 10 | Cat | Thomas |
----------------------------------------------
| Rachel | 10 | Cat | Fluff |
----------------------------------------------
| Jimmy | 11 | Dog | Kimba |
----------------------------------------------
| Lola | 10 | Cat | Thomas |
----------------------------------------------

12. Normalize the following table in to 2nd normal form

13. Map the following ERD in to table

You might also like