0% found this document useful (0 votes)
109 views47 pages

Edi 104 - Chapter 3

The document discusses entity relationship (ER) modeling and ER diagrams. It describes the key elements of an ER diagram as entities, attributes, and relationships. Entities can have attributes, and relationships connect entities and define cardinality. ER diagrams are used in database design to capture requirements and visualize how data is related before implementation. The document provides examples of how to construct ER diagrams for different scenarios like a book information system.

Uploaded by

Nursiti Dzulayha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views47 pages

Edi 104 - Chapter 3

The document discusses entity relationship (ER) modeling and ER diagrams. It describes the key elements of an ER diagram as entities, attributes, and relationships. Entities can have attributes, and relationships connect entities and define cardinality. ER diagrams are used in database design to capture requirements and visualize how data is related before implementation. The document provides examples of how to construct ER diagrams for different scenarios like a book information system.

Uploaded by

Nursiti Dzulayha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 47

CHAPTER

3
Entity Relationship Modeling

Subtopics:-

3.1 Entity Relationship (ER) Model


3.2 Relational Keys and Integrity Rules
3.3 Steps to Develop ER Diagram

Click or tap here to enter text.

Entity Relationship (ER) diagram is a graphical diagram used at the design stage of database system’s
development for gathering data.

ER diagram consists of three elements, which are entities, attributes and relationship, and they are each
associated to a notation or symbol for constructing a meaningful ER diagram.
However, the attribute, of which consists of another three sub-types, named as simple, multivalue,
composite and derived attribute are used as well for constructing more refined ER diagram.

Similarly, the relationship for connecting two entities comprises of description and cardinality, which
is the number of instances of one entity in relation to each instance of the related entity, to reflect the rule of
relationship to tackle business data’s requirements.

The relational keys and integrity rules, which are not notation of the ER Diagram, are studied here also
to anticipate the requirement to construct tables and setting the relationship between tables in Microsoft
Access, based on the ER diagram.

3.1 Entity Relationship (ER) Model


1|P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
3.1.1 Introduction to ER Model

Entity Relationship Modeling is a process used to help us to understand and document the informational
requirements of a system.

For example, a database system of your university, college, or school will consist of information, such as
students and the relevant particulars that include their names, addresses, birth dates, courses, enrolments,
grades and etc.

A database system is normally built according to three major stages:


1. requirements
2. design
3. implementation

To build the above mentioned database system, it consists of three steps, which are:
1. To gather the requirements and document the requirement using ER diagram.
2. Design the database system by transforming the developed ER model to the database design that
consists of tables, relationship and constraints.
3. Implement the system by capturing data for the system and put the system in good use.

3.1.2 ER Model and ER Diagram

The Entity Relation model is presented using the ER diagram.

Entity Relationship Diagram is a graphical diagram that depicts entity relationship model that comprises
entities, attributes and relationship. It also displays connectivity and cardinality.

Before looking into the Entity Relationship Diagram, let look into the example below to learn the association
of data and the three key concepts of Entity Relationship Diagram, that is, entities, attributes and
relationship.

2|P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Example: A Car Purchasing Model

Explanation for diagram:

The diagram above shows a car purchasing model that involves the relationship between the factory, car and
customer. Here, we can see clearly that the factory produces a particular car that has been purchased by a
customer.

Entity : FACTORY, CAR & CUSTOMER.


Relationship : Produce & Purchased by.
Attribute : FACTORY – name, address and number,
CAR – model, type, colour and plate number,
CUSTOMER – name, IC number, address and telephone number.

3.1.3 Elements of ER Model

There are 3 elements of ER Model:

- Entities
- Attributes (which include: simple, multivalued, composite, and derived)
- Relationship

3|P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
3.1.3.1 Notations of ER Model

The notations of ER Model are as described in Table 3-1.

The explanation for elements of ER is as describes in Table 3-2 :

4|P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
3.1.3.2 Entity

 Definition
- Entity is a person, place, object, event or concept, which you want to store the information in a table.
3
 Characteristic of entities:
- Must have an attribute and unique key.
- Will become a table in a database.

5|P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
 Classification of Entities:

PERSON Example: Student, Employee


PLACE Example: Country, Branch
OBJECT Example: Product, Building
EVENT Example: Student Registration, Payment
CONCEPT Example: Course, Order

 Entity Examples

 What is Entity Type?


- Entity type is a collection of entities, which share the same characteristic.

 What is Entity Instances?


- Entity instances are data for entity type.

Example of Entity Type and Entity Instances

Entity Type :- BOOK

Two entity instances for BOOK are :

1. code: P01
Name: Access 2000 Processing
Publisher Code: M-G1
Group Type: Database
Price: 76.00
In Store: Yes

2. Code: P02
Name: Concepts of Database Management
Publisher Code: P-H1
Group Type: Database
Price: 100.00
In Store: No

3.1.3.3 Attribute

 Attribute is a character of an entity or object.


 Attributes are the characteristics that describe entities.
 Attribute has a name and a data type.

6|P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Relationship

A relationship, which is an association between entities, is defined by a diamond shaped symbol in an ER


diagram. The relationship that is depicted by a diamond is labelled with verb or verb phrase.

7|P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
3.1.3.4 Cardinality Constraints

Figure 3-6 A Family Tree

The diagram above shows the hierarchy of En. Azhar's family. En. Azhar and Pn. Zainab have a daughter, 2
sons and 4 grandchildren. The relationship within his family members can be viewed clearly in this diagram.
The relationship between Azhar and Azlee is that Azlee is Azhar's son.

Cardinality Constraint

Definition: The number of entity type, which is involved in a relationship.

Types of cardinality constraints

a) One to One Relationship (1:1)

Definition: Maximum one X for each Y and 1 Y for each X.

Example :

An EMPLOYEE (who is the manager) manages only one BRANCH at a time and each branch only has
one manager.

8|P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
b) One to Many (1:M)

Definition: Maximum one X for each Y and possibly many Y’s for each X.

Example :

One FACULTY of a university offers many COURSES for students but every course must be
offered by one faculty. (menwarkn byk course)

c) Many to One (M:1)

Definition: Possibly many X’s for each Y and maximum one Y for each X.

Example:

Every day, many STUDENTS study in one CLASS ROOM at a time, but one class room is used by
many students at a time.
[Employee -> work in -> office]
d) Many to Many (M:N)

Possibly many X’s for each Y and many Y’s for each X.

9|P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Figure 3-12 Combination of ER Diagram (i) and (ii): A BOOK has one or more AUTHORS and an
AUTHOR writes one or more BOOKS.

Both Primary Keys attributes from BOOK & AUTHOR (ISDN & Author_ID) will become the attributes
for Composite Entity / Conceptual Entity (AUTHORING).

Examples of Relationship

Example:
One department has many employees.

10 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Example:
The employee handles project.

Solution:

11 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Example:
The publisher publishes books.

Solution:

12 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Example:
A lecturer teaches one or more subjects and many subjects are taught by lecturers.

Solution:

13 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Example:
Students register for at least a course. Attributes for student are Student_ID and Student_Name, while the
attributes for course are Course_Code and Course_Name.

Solution:

14 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
3.1.4 ER Diagrams

Example 1: ER Model of Book Information System

Figure 3-28 A Scenario of Book Information System

Books at MyBook bookstore are recorded. Information of the publishers and the authors is recorded to make
sure that the searching process for the book is easier.

Complete ER diagram

15 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Example 2: ER Model of Borrowing Book

Figure 3-30 A Scenario of Students borrowing Book

The picture above shows a student borrowing a book. The book was written by an author.

Complete ER diagram

Figure 3-31 Complete ER Diagram for Students borrowing Book

16 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Example: ER Model of Department, Employee and Project

The picture above show one department that has many workers and each worker is responsible for one
project.

Complete ER diagram

17 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
3.2 Relational Keys and Integrity Rules

Relational Key Definition

 A key consists of one or more attributes that can be identified in a row.


 Relational key is an attribute that relates one entity with another entity in a relationship.

Why we need Relational Key?

 Relational key enables us to link the tables together in a database for easier data access storage.

3.2.1 Types of Relational Keys


Types Definition
Candidate Key An attribute or group of attributes that identify a unique row in a relation.
One of the candidate keys is chosen to be the primary key.
Primary Key Any of the candidates that are selected to be the key or an attribute that uniquely
identifies each row in a relational table.
Foreign Key An attribute in one table whose values must match the primary key in another
table or whose value must not be null.
Attribute that acts as a primary key in a related table.
Composite Key A primary key that consists of more than one attribute, especially in(M:N)
relationship.

Example:

a) Below is the example of Candidate Key by referring to tables in MyBook database.

Figure 3-34 Candidate Keys


Publisher_Code and Book_Code are CANDIDATE KEYS because both can uniquely identify a row
in a relational table.

One table can have more than one CANDIDATE KEYS *

b) Below is the example of Primary key referring to the table in MyBook database.

18 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Figure 3-35 Primary Key

Publisher_Code is a PRIMARY KEY for table PUBLISHER and Book_Code is the PRIMARY
KEY for table BOOK. Both primary keys can uniquely identify a row in a relational table.

19 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
c) Below is the example of foreign key referring to the table in MyBook database.

Publisher_Code is a PRIMARY KEY for PUBLISHER table but it is a FOREIGN KEY for
BOOK table.

For a table that have a M :1 or 1:M relationship, PRIMARY KEY for table (1) must be added
in table (M) as a FOREIGN KEY. *

20 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
d) Below is the example of Composite key referring to the table in MyBook database.

Combination of Book_Code and Author_No can determine the books that are written by the author.

Many to Many Relationship (M:N) will create a new table that inherits PRIMARY KEY from both
tables related to it.*

21 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
3.2.2 Types of Integrity Rules

Two types of integrity constraint are Entity Integrity and Referential Integrity.

a) Entity Integrity

Requirement:
All entries are unique and no part of a primary key may be null.

Purpose:
Guarantees that each entity will have a unique identity and ensures that foreign key values can properly
refer to primary key values.

Example :

Publisher_Code is the PRIMARY KEY in PUBLISHER table, so this field cannot have a null value and all
entries are unique.

Example:

Publisher_Code is the PRIMARY KEY in PUBLISHER table as shown below, so this field cannot have a
null value.

Figure 3-39 Integrity Rules

22 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
b) Referential Integrity

Referential integrity is a set of rules that prevents you from changing or deleting a record if matching
records exist in a related table.

Requirement :
If foreign key exist in one table then the foreign key value must reference an existing primary key value in
a table to which it is related and it can be null.

Purpose :
i) Possibility for non-corresponding value, but impossible for invalid entity.
ii) Referential integrity rule disables row deletion of a table consisting primary key matching key
values in another table.

Example :

Publisher_Code is a PRIMARY KEY for PUBLISHER table, but it is also a FOREIGN KEY for BOOK
table. Please note that FOREIGN KEY value in table BOOK must match the PRIMARY KEY value in
PUBLISHER table.

23 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
3.3 Steps to Develop ER Diagram

Figure 3-41 Steps to Develop ER Diagram

24 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Example :

 Relationship between STUDENT and COURSE entity is (M:1).

 Attribute for STUDENTS :


- Student_ID (Primary key)
- Name (Simple attribute)
- Address (Composite attribute)
- Phone_No (Multivalued attribute)
- Age (Derived attribute)
- Course_Code (Foreign attribute)
3
 Attribute for COURSE :
- Course_Code (Primary key)
- Course_Name (Simple attribute)

Example :

A company has several departments. Each department has a supervisor and at least one employee.
Employees must be assigned to at least one department. Project will be given to the employee and it will be
done in a group. At least one employee is assigned to one project or more. The important data fields are the
names of the departments, projects, supervisors and employees, as well as the supervisor and employee
number, department code and a unique project number.

Step 1 : Identify entity

a) Department
b) Supervisor
c) Employee
d) Project

Step 2 : Identify relationship

a) Each department has one supervisor

25 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
b) Each department has at least one employee

c) Employees must be assigned to at least one department.

d) Project will be given to the employee

Step 3 : Sketch ER diagram

26 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Step 4 : State cardinality constraint

Based on the problem above, cardinality constraint are:

a) Each department has one supervisor

b) Each department has at least one employee. Employees must be assigned to at least one department.

Figure 3-45 ER Diagram A : Each department has at least one employee

c) Project will be given to the employee and it will be done in a group. At least one employee is assigned to
a project or more.

27 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Step 5 : Identify primary key for each entity

Entity Primary Key


DEPARTMENT Department_No
EMPLOYEE Employee_No
SUPERVISOR Supervisor_No
PROJECT Project_No

Step 6 : Identify attribute for each entity

Entity Attribute
DEPARTMENT Department_Name
EMPLOYEE Employee_Name
SUPERVISOR Supervisor_Name
PROJECT Project_Name

The complete ER diagram

28 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Example :

Create an ER diagram for the following requirements with the appropriate attributes for each entity type and
structural constraints for each relationship type.

(a) An INVOICE is written by a SALESREP. Each sales representative can write many invoices, but each
invoice is written by a single sales representative.

(b) The INVOICE is written for a single CUSTOMER. However, each customer can have many invoices.

(c) An INVOICE can include many details (DETAIL-LINES), which describe the products bought by the
customer.

(d) The product information is stored in a PRODUCT entity.

Step 1 : Identify entity

a) Invoice
b) Sales Representative
c) Customer
d) Detail-Lines
e) Product

Step 2 : Identify relationship

a) Sales representatives writes Invoice

b) An invoice is written for every Customer

c) Invoice contains Detail

d) Detail references to Product

29 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Step 3 : ER diagram

Figure 3-51 ER Diagram for SALEREP, CUSTOMER, INVOICE and PRODUCT

Step 4 : State cardinality constraint

a) Each sales representative can write many invoices, but each invoice is written by a single sales
representative.

30 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
b) The INVOICE is written for a single CUSTOMER. However, each customer can have many invoices.

c) An INVOICE can include many details (DETAIL), which describe the products bought by the customer.

d) The product information (DETAIL) is stored in a PRODUCT entity.

31 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Step 5 : Identify primary key for each entity

Entity Primary Key


INVOICE Inv_No
SALESREP SlsRep_ID
CUSTOMER Cust_No
DETAIL-LINES Detail_No
PRODUCT Product_Code

Step 6 : Identify attribute for each entity


Entity Attribute
INVOICE Inv_No, Inv_date
SALESREP SlsRep_ID, SlsRep_Name, SlsRep_Tel_No
CUSTOMER Cust_No, Cust_Name, Cust_Addr, Cust_Tel_No
DETAIL-LINES Detail_No, Prod_Qty
PRODUCT Prod_ Code, Product_Name, Prod_Type
32 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
The complete ER diagram

33 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Example :
You have been requested by a travel agency, EXEL Travels, to build a database for storing information on
customers and vacation package that have been booked. Create an ER Diagram based on the information
below:

 Each customer has information like Customer Number, Name, Address and Telephone number.
 Customers may have many addresses and telephone numbers.
 A customer may book more than one holiday package and one holiday package may also be booked
by many customers.
 Examples of payments according to booked holiday package :
Package A : New Zealand (3 days) - RM 3500
Package B : New Zealand (7 days) - RM 5000
Package C : New Zealand (10 days) - RM5990

Step 1 : Identify entity

a) Customer
b) Holiday Package

Step 2 : Identify relationship

a) Customer book HOLIDAY PACKAGE.

Step 3 : ER diagram

Step 4 : State cardinality constraint

a) Customer book HOLIDAY PACKAGE.

34 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Step 5 : Identify primary key for each entity

Entity Primary Key


CUSTOMER Cust_No
HOLIDAY PACKAGE Package_Code

Step 6 : Identify attribute for each entity

Entity Attribute
CUSTOMER Cust_No, Cust_Name, Cust_Addr, Cust_Tel
HOLIDAY PACKAGE Package_Code, Location, Duration, Payment

The complete ER diagram

Example :
Hospital Jaya is based in Kuala Lumpur. This Hospital has a few wards with several patients. This ward has
a few types, which depends on types of patients.

Patients will be recorded into file that have ID Patient, Patient name, address, phone number, IC-number,
categories either VIP or regular patient and a group of blood patient.

Each patient is treated by a doctor at one time but one doctor can treats a number of patients. The
information of doctors recorded is: Doctor ID, name, address, phone number, IC-number and specialization.

The nurses will be assigned to take care of the patients. Nurses in this hospital are graded based on their
experience, qualification and duration of working in the hospital.

35 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Step 1: Identify entity

a) Ward
b) Patient
c) Doctor
d) Nurse

Step 2: Identify relationship

a) This Hospital has a few wards with several patients

b) Each patient is treated by a doctor at one time but one doctor can treats a number of patients.

c) The nurses will be assigned to take care of the patients.

Step 3: ER diagram

36 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Step 4 : State cardinality constraint

a) This Hospital has a few wards with several patients.

b) Each patient is treated by a doctor at one time but one doctor can treats a number of patients.

c) The nurses are assigned to a ward to take care of different patients during their stay.

37 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Step 5 : Identify primary key for each entity

Entity Primary Key


WARD WardID
PATIENT PatientNo
DOCTOR DoctorNo
NURSE NurseNo

Step 6 : Identify attribute for each entity

Entity Primary Key


WARD Type , WardID
PATIENT PatientNo, PatientN, PatientAdd, PatientIC,
PatientTelNo, Category, TypeBlood
DOCTOR DoctorNo, DoctorN, DoctorAdd, DoctorTelNo,
DoctorIC, Specialization
NURSE NurseNo, NurseN, NurseAdd, Experience, Qualification,
DurationWorking

38 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
The complete ER diagram

Beside the above method, ER diagram can also be creating based on the form or report that will be produce
by the database system that you create.

Example :

Based on the form below, draw a complete ER diagram.

39 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Step 1 : List down the data (attribute) that can be the primary key

a) Customer No
b) Asset No
c) Owner No

Based on the primary key, we can determine the entity that may be appearing in the ER diagram.

The possible entities are: CUSTOMER, ASSET, OWNER

Step 2 : Make an assumption based on the form.

Assumption:

The form display:

a) Every customer makes rental

b) Every rental has an asset

c) An asset is own by owner

Step 3 : ER diagram

40 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Step 4 : State cardinality constraint

a) Customer make rental.

b) Rental based on asset

41 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
c) Asset is owned by owner

Complete ER diagram

42 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
SUMMARY FOR CHAPTER 3 : ENTITY RELATIONSHIP MODEL

 ER Model is used for constructing ER diagram based on the conventions of ER diagram and the user
data.

 Notation of ER Model :

 Entity is a person, place, object, event or concept, which you want to store the information in the
database.

 Attribute is a character of an entity or object.

 Relationship is an association between entities; which is defined by a diamond shaped in an ER


Diagram.

 Cardinality constraint is the number of entity type, which is involved in a relationship.

 There are three types of cardinality constraints, 1:1, 1:M, M:N.

 Relational keys are device that relates one entity with another entity in a relationship.

43 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
 Types of keys :

Types Definition
Candidate Key An attribute or group of attributes that identify a unique row in a relation.
One of the candidate keys is chosen to be the primary key.
Primary Key Any of the candidates that are selected to be the key or an attribute that uniquely
identifies each row in a relational table.
Foreign Key An attribute in one table whose values must match the primary key in another
table or whose value must not be null.
Attribute that acts as a primary key in a related table.
Composite Key A primary key that consists of more than one attribute, especially in(M:N)
relationship.

 Entity Integrity is used to make sure that all data entries are unique and no part of primary key can be
null.

 Referential Integrity is a set of rules that prevents you from changing or deleting a record if matching
records exist in a related table.

 ER diagram is a graphical diagram that depicts an entity relationship model entities, attributes, and
relations. It also displays connectivity and cardinality.

 Steps to draw an ER Diagram :

44 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
Exercise

1. Entity Relationship diagram

a) is a set of rules that prevents you form changing or deleting a record if matching records exist in a
related table
b) is a diagram that depicts an entity relationship model entities, attributes, and relations
c) is used to make sure that all data entries are unique
d) is a character of an entity or object.
e) is a collection of entities, which share the same characteristic

2. 4 types of attributes are as follows, except:

a) Primary
b) Composite
c) Derived
d) Multivalued
e) Simple

3. Several types of relational keys, except :

a) Candidate key
b) Primary key
c) Foreign key
d) Secondary key
e) Composite key

4. Foreign Key is

a) an attribute or group of attributes that identifies a unique row in a relation


b) any of the candidates that are selected to be the key or an attribute that uniquely identifies each
row in a relation.
c) an attribute in one table whose values must match the primary key in another table or whose
value must be null
d) a primary key that consists of more than one attribute, especially in (M:N) relationship
e) none of above statement is true.

5. “A college has many courses”. Which cardinality constrains below describe the statement?

45 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
6. Based on the table below, determine the entities that may be appearing in the ER diagram

I. House No.,
II. Owner Name
III. Owner No.
IV. Renovation

a) I, II
b) I,II,III
c) I, III
d) I, IV
e) II, III, IV

7. Fill in the box with types of attributes and keys in the ER diagram below.

8. Three elements of ER model are ______________________, _____________________ and


_________________________.

9. ____________________________ a property or characteristic of an entity or relationship.

46 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g
10. ______________________ is an interaction of 2 entities and represented by a verb.

11. Entity Instances is a data for _____________________________.

12. Draw a complete ER model and cardinality constraint for the sentences below. Add the possible attribute
for each entity.

“Many staff work at one department only and one department may consist of many facilities.”

47 | P a g e C h a p t e r 3 : E n t i t y r e l a t i o n s h i p m o d e l i n g

You might also like