ITS232 Introduction To Database Management Systems

59
ITS232 Introduction To Database Management Systems Siti Nurbaya Ismail Faculty of Computer Science & Mathematics, Universiti Teknologi MARA (UiTM), Kedah | [email protected] | http://www.sitinur151.wordpress.com | | A2-3039 | ext:2561 | 019-5710562 | CHAPTER 4 Entity Relationship (E-R) Modeling (ERD)

description

ITS232 Introduction To Database Management Systems . Siti Nurbaya Ismail Faculty of Computer Science & Mathematics, Universiti Teknologi MARA ( UiTM ), Kedah | [email protected] | http://www.sitinur151.wordpress.com | | A2-3039 | ext:2561 | 019-5710562 |. CHAPTER 4 - PowerPoint PPT Presentation

Transcript of ITS232 Introduction To Database Management Systems

Page 1: ITS232 Introduction To Database Management Systems

ITS232Introduction To Database Management Systems

Siti Nurbaya IsmailFaculty of Computer Science & Mathematics,

Universiti Teknologi MARA (UiTM), Kedah| [email protected] | http://www.sitinur151.wordpress.com |

| A2-3039 | ext:2561 | 019-5710562 |

CHAPTER 4Entity Relationship (E-R) Modeling

(ERD)

Page 2: ITS232 Introduction To Database Management Systems

4.0 Entity Relationship (E-R) Modeling4.1 The Entity Relationship (ER) Model 4.2 Developing An E-R Diagram 4.3 Database Design Challenges

Chapter 4: Entity Relationship (E-R) Modeling

Page 3: ITS232 Introduction To Database Management Systems

3

Chapter 4: Entity Relationship (E-R) ModelingBasic Modeling Concept

A model is description or analogy used to visualize something that cannot be directly observed.

Page 4: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) ModelingBasic Modeling Concept

4

• Relatively simple representations of complex real world data structures

• Represents:– data structures and their characteristics– relation and constraints

• Can be physical or abstract:– car, student = physical– subject, register= abstract

• Used by database designer as:– communications tools to communicate and understanding

between a client and the database designer, which the database to be develop.

Page 5: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) ModelingBasic Modeling Concept

5

The importance of data modeling:

• Data– constitute the most basic information units employed by a system

• Application – is created to manage data and to transform data to information

• View– different people views the same data differently based on their

understanding• Model

– helps different user to have the holistic view of the same data

Page 6: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) ModelingBasic Modeling Concept

6

The importance of data modeling:

Data Application

View 1

View 2

View n

Model

holistic view of the same data

Page 7: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) ModelingBasic Modeling Concept

7

2. Conceptual level

3. Internal level

Physical data organization

1. External level View 1 View 2 View n

Conceptual Schema

Internal Schema

Database

User nUser 2User 1

Conceptual Model

External Model

Internal Model

Physical Model

-designer’s view-h/w independent-s/w independent

-DBMS’s view-h/w independent-s/w dependent

-h/w dependent-s/w dependent

-user’s view

ERD

Three Level ANSI-SPARC Architecture

Page 8: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.1 The Entity Relationship (E-R) Model

8

Based on the set theory and the relational theory, it is used as tools to:– translate different views of data among managers, users and

programmers to fit into a common work– define data processing and constraints to help meet the different

views– help implement the database– considered as a stage in a database design preceding the relational

database modeling– gives data structures representation of:

* what information have to be stored* the relationships between informational elements and

constraint on the data structure * relationship

Page 9: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.1 The Entity Relationship (E-R) Model

9

• ER model forms the basis of an ER diagram (ERD)• ERD represents conceptual database as viewed by end user• ERDs depict database’s main components:

– Entities– Attributes– Relationships

Page 10: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.1 The Entity Relationship (E-R) Model: Entity

10

Entity• Refers to entity set and not to single entity occurrence• Corresponds to table and not to row in relational environment• In both Chen and Crow’s Foot models, entity is represented by

rectangle containing entity’s name• Entity name, a noun, is usually written in capital letters

Chen Model Crow’s Foot Model

STUDENT SUBJECT STUDENT SUBJECT

Page 11: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.1 The Entity Relationship (E-R) Model: Entity

11

Entity• An entity is a thing that exists and can be distinguishable

• concrete/physical (individual, place, object)• conceptual/abstract (events, concepts)

• Examples;• Jeffry, 2009222624 STUDENT• Mathematics II, MAT111 SUBJECT

• Have property that can explains about the entity• Entity set a set of entity

Page 12: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.1 The Entity Relationship (E-R) Model: Attribute

12

Attribute• Characteristics of entities• Property that explains about entity• Correspondents to fields of a table• Primary key are underline with a straight line• Foreign key are underline with dotted line or an *

Chen Model Crow’s Foot Model• attributes are represented by

ovals and are connected to entity rectangle with a line

• each oval contains the name of attribute it represents

• attributes are written in attribute box below entity rectangle

Page 13: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.1 The Entity Relationship (E-R) Model: Attribute

13

Chen Model Crow’s Foot Model

STUDENT

studentID

name

course

SUBJECTcodecreditname

STUDENT

studentIDcoursename

SUBJECT credit

name

code

Page 14: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.1 The Entity Relationship (E-R) Model

14

Chen Model Crow’s Foot ModelERD

TABLE

RATIONALSCHEMA

STUDENT(studentID, name, course)SUBJECT(code, name, credit)

STUDENT

studentID

name

course

SUBJECT

codenamecredit

STUDENT

studentIDnamecourse

SUBJECT credit

name

code

studentID name course

………………… ……… ……………

code name credit

……………

……………… ……………

STUDENT SUBJECT

Page 15: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.1 The Entity Relationship (E-R) Model: Relationship

15

Relationship• Associates between entities• Logical interaction among the entities in a relational database • Operate in both directions

Chen Model Crow’s Foot Model• Weak Relationship

• Strong Relationship

• Weak Relationship

• Strong Relationshipworkshas

works

has

works

Page 16: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram

16

Development of ER model is an Iterative Process that involved:• Step1:

General narrative of organizational operations developed• Step2:

Basic E-R Model graphically depicted and reviewed• Step3:

Modifications made to incorporate newly discovered ER components

• Repeat process: Until designers and users agree on complete E-R Diagram

Page 17: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Model Components

17

Chen Model Crow’s Foot ModelENTITY

ATTRIBUTE

RELATIONSHIP

STUDENT STUDENT

STUDENT

studentID

name

course

STUDENTstudentIDcoursename

works works

Page 18: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Model Components

18

ENTITY Variations of entity:i. Weakii. Recursiveiii. Compositeiv. Supertype/Subtype

ATTRIBUTE Types of attribute:i. Simple attributesii. Composite attributesiii. Multivalued attributesiv. Derived attributes

RELATIONSHIP Relationship can be describes by:i. Degree of the relationshipii. Connectivity of the relationshipiii. Cardinality of the relationshipiv. Participation

Page 19: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Entity

19

Entity• Corresponds to table and not to row in relational environment• Represented by rectangle containing entity’s name• Entity name, a noun, is usually written in capital letters• Examlpe: Entity STUDENT with attributes

STUDENT

studentID

name

courseemail

address

Page 20: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Entity

20

Variations of Entity:i. Weak Entityii. Recursive Entityiii. Composite Entityiv. Entity Supertype and Subtype

Page 21: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Entity

21

Variations of Entity:i. Weak Entity

• Existence dependency• Primary key derived from parent entity• Example: DEPENDENT entity

EMPLOYEE(employeeNO, employeeNAME)DEPENDENT(employeeNO, depNO, depDATE, depNAME)

EMPLOYEE

employeeNO

employeeNAME DEPENDENTDEPENDENT

employeeNO

depNAME

depDATE

depNO

has1(0,N)

1(1,N)

employeeNO employeeNAME111 Ali222 Ah Chong333 Bazil

employeeNO depNO depNAME depDATE111 1 Zara 05/05/05111 2 John 25/12/09333 3 Syamil 28/10/09333 1 Jazmeen 01/01/11

Page 22: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Entity

22

Variations of Entity:ii. Recursive Entity

• Entity set that have relationship with the same entity set• Example: EMPLOYEE entity

employeeNO employeeNAME employeeSPOUSE111 Ali 444222 Ah Chong333 Bazil444 Sheriz 111

employeeNO employeeNAME employeeMANAGER111 Ali 333222 Ah Chong 333333 Bazil 333444 Sheriz

EMPLOYEEemployeeNO

employeeNAME

married

11

employeeSPOUSE

EMPLOYEEemployeeNO

employeeNAME

manage

11

employeeMANAGER

Page 23: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Entity

Variations of Entity:iii. Composite Entity

• Originally a relationship between 2 entities that involved in M:N relationship

• Composite entity takes its primary key from both entities that it bridges

• Example: enroll

studentID studentNAME200922222200933333200944444200955555

courseID courseNAMEITS232 DatabaseCSC318 IPCSC203 OS

STUDENTstudentID

studentNAME

enrollM

grade

COURSE courseID

courseNAME

N

studentID courseID grade200922222 ITS232 A+200922222 CSC318 B+200933333 CSC203 B200955555 ITS232 A-

STUDENT STUDENT_COURSE / ENROLL COURSE

1 1

Page 24: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Entity

24

Variations of Entity:iv. Entity Supertype & Subtype

• Parent-Child relationship

• Supertypecontains the shared attributes an entity type that include distinct subclasses

that required to be presented in data model parent

• Subtype contains the unique attributesan entity type that has a distinct role and also

a member of supertypechild

Page 25: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Entity

25

Variations of Entity:iv. Entity Supertype & Subtype

• Example: Superype (EMPLOYEE) Subtype (Engineer & Full-Time)

Employee(emp_no, emp_name)Manager(emp_no, emp_name,bonus)

Page 26: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Entity

26

Variations of Entity:iv. Entity Supertype & Subtype

• Have two types of relationship:Disjoint Overlapping

Unique subtypeNon-overlapping: subtypes can be one of the types

Overlapping:Subtypes can be either one or both of the subtypes

Indicate with: Indicate with:

G Gs

Page 27: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Entity

27

Variations of Entity:iv. Entity Supertype & Subtype

• Example: Disjoint & Overlap

Overlap

Disjoint

G

Gs

Page 28: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Entity

28

Variations of Entity:iv. Entity Supertype & Subtype

• Example: Disjoint

Page 29: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Entity

29

Variations of Entity:iv. Entity Supertype & Subtype

• Example: Disjoint & Overlap

Page 30: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Attributes

30

Attributes• Represented by ovals that are connected to entity with a line• Oval contains of attribute (field) it represents• PK are underlined with straight line• FK are underlined with doted line or *• Example: Entity STUDENT with attributes

name, course, studentID, address, email

STUDENT

studentID

name

courseemail

address

Page 31: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Attributes

31

Attributes types:i. Simple Attributesii. Composite Attributesiii. Multivalued Attributesiv. Derived Attributes

Page 32: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Attributes

32

Attributes types:i. Simple Attributes

• An attribute composed of single component with an independent existence

• Cannot be subdivided into smaller components• Example: gender, martial statues

STUDENT studentIDphoneNO

age

gendername

address addressTOWN

addressPOSTCODEaddressNO

Simple Attributes

Page 33: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Attributes

33

Attributes types:ii. Composite Attributes

• An attribute composed of multiple components, each with an independent existence

• Can be further subdivide to yield additional attributes• Example: name first, middle, last

address street, city, state, zip

Composite Attributes

STUDENT studentIDphoneNO

age

gendername

address addressTOWN

addressPOSTCODEaddressNO

Page 34: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Attributes

34

Attributes types:iii. Multivalued Attributes

• attribute that holds multiple values for each occurrence of an entity type

• Should not be implemented multivalued attributes in relational database

• Can simplifies multivalued attributes by:a. Create several attributesb. Create new entity of the original multivalued attributes

components• Example: phone number handset,office,homequalification diploma,degree,master

Page 35: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Attributes

35

Attributes types:iii. Multivalued Attributes

• Can simplifies multivalued attributes by:a. Create several attributes

b. Create new entity of the original multivalued attributes components

gender

STUDENT

studentID

handsetNO

age

address

CONTACThas

homephoneNO

studentID*

STUDENTage

gender

address

handsetNO

homephoneNOstudentID

Page 36: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Attributes

36

Attributes types:iv. Derived Attributes

• An attributes that represents a value that is derived from the value of related attribute or set of attributes, not necessarily in the same entity type.

• Should not implement derived attributes in relational database• Example: age, cgpa

Derived Attributes

STUDENT studentIDphoneNO

age

gender

name

address

Page 37: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Relationship

37

Relationship• Associations between entities • Logical interaction among the entities in a relational database• Operates in both directions• Naming Relationships:

• Relationship name is a verb phrase• Avoid vague names

• Defining Relationships:• Definition explains what action is being taken and why it is important• Give examples to clarify the action• Optional participation should be explained• Explain reasons for any explicit maximum cardinality• Explain any restrictions on participation in the relationship• Explain extent of the history that is kept in the relationship• Explain whether an entity instance involved in a relationship instance can

transfer participation to another relationship instance

Page 38: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Relationship

38

Relationship is described by:i. Degree of the relationshipii. Connectivity of the relationshipiii. Cardinality of the relationshipiv. Participation

Page 39: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Relationship

39

Relationship is described by:i. Degree of the relationship

• Indicates number of associated entities within the relationship• There are three types:

a.Unary Relationship

b.Binary Relationship

c. Ternary Relationship

STAFF married

LECTURER teach CLAS

CANDIDATE teach INTERVIEW

MANAGEMENT

Page 40: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Relationship

40

Relationship is described by:ii. Connectivity of the relationship

• Logical interaction among entities in a relational database• There are three types:

a.1:1

b.1:M

c. M:N

STUDENT under PROGRAM

UiTMBRANCH have RECTOR

STUDENT register COURSE

1 1

1 M

11 M N

Page 41: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Relationship

41

Relationship is described by:iii. Cardinality of the relationship

• Express the specific number of entity occurrences associated with one occurrence of the related entity

• Function of organizational policy business rules

Page 42: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Relationship

42

Relationship is described by:iii. Cardinality of the relationship

• Example 1:One student can register 1 to 9 coursesOne course maximum can have 35 student

(1,9) (0,35)STUDENT register COURSENM

Page 43: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Relationship

43

Relationship is described by:iii. Cardinality of the relationship

• Example 2:One lecturer can teaches maximum 3 coursesOne course can be thought by 1 lecturer only

(0,3) (1,1)LECTURER teach COURSEM1

Page 44: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Relationship

Relationship is described by:iii. Cardinality of the relationship

• Relationship Strength Existence Dependence• Entity’s existence depends on the existence of one or more other

entities

namestaffNO

STUDENT

namestudentID

staffNO*refer

supervise

SUPERVISORstaffNO

name______ __________ ____

STUDENTstudentID name staffNO________ ____ ______________ ____ ______

referSUPERVISOR

Page 45: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Relationship

Relationship is described by:iii. Cardinality of the relationship

• From Existence Dependence, exist two relationship strength:a. Weak Relationship

Entity not existence-independent on other entity PK of related entity doesn’t contain PK component of parent

entity Non-Identifying Relationship

b. Strong Relationship Existence dependence PK of related entity contains PK component of parent entity Identifying Relationship 45

Page 46: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Relationship

Relationship is described by:iv. Participation

• Determines whether all or some entity occurrences participates in a relationship

• There are two types:a. Optional (Partial)

Condition in which other participating entity may or may not be associated with occurrences of the optional entity in the relationship

b. Mandatory (Total) Condition in which one participating entity must be

associated with one or more occurrences of the other participating entity in the relationship 46

Page 47: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Chen Model: Relationship

Relationship is described by:iv. Participation

• Example 1:One lecturer can teaches maximum 3 coursesOne course can be thought by 1 lecturer only

(0,3) (1,1)LECTURER teach COURSEM1

connectivity

cardinality

One class can be thought by one lecturer only

One lecturer can teachesmaximum 3 classes

participation

‘not all lecturer teach class’ optional participation for course

‘all class are teach’ (mandatory participation for lecturer)

Page 48: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Comparison of E-R Model

48

Alternate style developed to enable easier use of CASE tools.

Chen ModelThe Chen notation favors conceptual modeling

Crow’s Foot ModelCrow’s Foot notation favors a more implementation-oriented approach

UML ModelUML notation can be used for both conceptual and implementation modeling

Page 49: ITS232 Introduction To Database Management Systems

Comparison of E-R Modeling SymbolsCardinality & Participation Chen Model Crow’s Foot Model

Entity

Weak Entity

Composite Entity

Relationship line

Relationship

Option Symbol

One (1) Symbol

Many (M) Symbol

1

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Comparison of E-R Model

M

Page 50: ITS232 Introduction To Database Management Systems

Summary of Cardinality and Participation for a Strong RelationshipCardinality & Participation Chen Model Crow’s Foot Model

1:1, both side mandatory

1:M, both side mandatory

M:N, both side mandatory

1:1, both side optional

1:M, both side optional

M:N, both side optional

1:M, one side mandatory and many side optional

has1 1(1,1) (1,1)

has1 M(1,n) (1,1)

hasM N(1,n) (1,n)

has1 1(0,1) (0,1)

has1 M(0,n) (0,1)

hasM N(1,n) (0,n)

has1 M(0,1) (1,1)

has

has

has

has

has

has

has

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Comparison of E-R Model

Page 51: ITS232 Introduction To Database Management Systems

Chen Model

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Comparison of E-R Model

Page 52: ITS232 Introduction To Database Management Systems

Crow’s Foot Model

Chapter 4: Entity Relationship (E-R) Modeling4.2 Developing An E-R Diagram: Comparison of E-R Model

Page 53: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) Modeling4.3 Database Design Challenges

Conflicting Goals• Database designers often must make design compromises that are

trigged by conflicting goals, such as comply with the design standards, processing speed and information requirements.

• In order to do so, – it is very important to have the entities, attributes, and

relationships clearly identified and well-defined– there is a need in balancing between the customer needs and a

design that meets logical requirements and conventions– The more thinking and modeling is done the less money and

time are needed later on for rework

• Additional concerns are security, performance, shared access and integrity

53

Page 54: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) ModelingExercise 1

54

• An employee manages one store; each store is managed by one employee

• Answers

manageEMPLOYEE STORE1 1

Page 55: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) ModelingExercise 2

55

• A painter can paint many paintings; each painting is painted by one painter. A gallery can have many paintings. A painting can be exhibited by a gallery.

• Answers:

PAINTER PAINTING GALLERYpaint displayM1 1M

Page 56: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) ModelingExercise 3 (a):

56

• Students in Morris College discover that each course can have many sections, but each section refers to only one course.

• Answers

hasCOURSE SECTION(0,N)(1,1)

M1

Page 57: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) ModelingExercise 3 (b):

57

• Each student in Morris College can take many classes (or none) and each class can contain many students.

• Answers:

takeSTUDENT

(0,N)

(1,M)

M

N

CLASS

Page 58: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) ModelingExercise 3 (c):

58

Apply business rules in exercise 3(a) & 3(b).• Students in Morris College discover that each course can have many

sections, but each section refers to only one course. • Each student in Morris College can take many classes (or none) and

each class can contain many students.(class and course in Morris College refer to the same entity)

takeSTUDENT

(0,N)

(1,M)

M

N

hasCOURSE CLASS(0,N)(1,1)

M1

Page 59: ITS232 Introduction To Database Management Systems

Chapter 4: Entity Relationship (E-R) ModelingExercise 3 (d):

Apply business rules in exercise 3(a) & 3(b).• Students in Morris College discover that each course can have many

sections, but each section refers to only one course. • Each student in Morris College can take many classes (or none) and

each class can contain many students.(class and course in Morris College refer to the same entity)

• Some course in Morris College may have prerequisite course.• Students will have enroll grade for every course they have taken.

hasM1

takeSTUDENT

(0,N)

(1,M)

M

N

COURSE CLASS(0,N)(1,1)

prerequisite

grade