DBMS Lecture 3 Developing An ER Diagram
DBMS Lecture 3 Developing An ER Diagram
DATCOM Lab
Faculty of Data Science and Artificial
Intelligence College of Technology, National
Economics University Email:
[email protected], [email protected]
Overview
2 Tiny
College
Overview
operations.
▶ Identify the main entities and relationships from the
business rules.
▶ Develop the initial ERD.
Overview
During the review process, additional objects, attributes, and
relationships probably will be uncovered.
The basic ERM will be modified to incorporate the newly discovered
ER components.
Another round of reviews might yield additional components or
clarification of the existing diagram.
The process is repeated until the end users and designers agree that
the ERD is a fair representation of the organization’s activities and
functions.
During the design process, the database designer does not depend
simply on interviews to help define entities, attributes, and
relationships.
▶ A surprising amount of information can be gathered by examining the
business forms and reports that an organization uses in its daily
operations.
DATCOM Lab (DATCOM Lab) September 19, 4 / 19
Tiny
College
The interview
process
1 Tiny College (TC) is divided into several schools:
The interview
process
3 Each department may offer courses.
▶ Tiny College had some departments that were classified
as ”research only,” they would not offer courses;
therefore, the COURSE entity would be optional to the
DEPARTMENT entity.
The interview
process
The interview
process
The interview
process
Each department should have one or more professors assigned to it.
5
One and only one of those professors chairs the department, and no
professor is required to accept the chair position.
▶ Therefore, DEPARTMENT is optional to PROFESSOR in the ”chairs”
relationship.
DEP_CODE: k yêu cầu phải là unique vì nhiều giáo sư có thể chung 1 dep
Prof_num: phải yêu cầu là quy nhất vì 1 giáo siuw chỉ làm trưởng 1 bộ môn
và là duy nhất
The interview
process
6 Each professor may teach up to four classes; each class
is a section of a course. A professor may also be on a
research contract and teach no classes at all.
Trong ERD thì k xác định được là 4 lớp mà chỉ xác định là
quan hệ 1:N.
1 lớp có 1 giáo sư và có giáo sư k dạy lớp nào cả
The interview
process
7 A student may enroll in several classes but take each
class only once during any given enrollment period.
▶ Each student may enroll in up to six classes, and each
class may have up to 35 students, thus creating an M:N
relationship between STUDENT and CLASS.
▶ Because a CLASS can initially exist at the start of the
its
DATCOM (composite)
Lab (DATCOM Lab) PK is composed of the PKs of the STUDENT
September 19, and
11 /
Tiny
College
The interview
process
The interview
process
8 Each department has several (or many) students whose
major is offered by that department. However, each
student has only a single major and is therefore
associated with a single department.
▶ However, in the Tiny College environment, it is possible for
a student not to declare a major field of study. Such a
student would not be associated with a department,
therefore, DEPARTMENT is optional to STUDENT.
The interview
process
9 Each student has an advisor in his or her department;
each advisor counsels several students.
▶ An advisor is also a professor, but not all professors advise
students.
Therefore, STUDENT is optional to PROFESSOR in
the ”PROFESSOR advises STUDENT” relationship.
The interview
process
1
0
The CLASS entity contains a ROOM CODE attribute which
is an FK to another entity. Clearly, because a class is
taught in a room, it is reasonable to assume that the
ROOM CODE in CLASS is the FK to an entity named
ROOM.
▶ Each room is located in a building. BUILDING can
contain many ROOMs, but each ROOM is found in a
single BUILDING.
The interview
process
The interview
process
The table summarizes the ERM’s components, and names
the entities and their relations.
The interview
process
Questio
ns