0% found this document useful (0 votes)
30 views58 pages

Unit-2-DAY 5 - 20 - 09

This document provides guidelines for understanding and applying the Entity-Relationship (ER) model in database design, covering topics such as database schemas, data abstraction, and ER modeling concepts. It outlines the different levels of data abstraction, including conceptual, logical, and physical schemas, and explains the characteristics of entities, attributes, and relationships. Additionally, it discusses the importance of data modeling techniques and the conversion of ER models to relational tables.

Uploaded by

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

Unit-2-DAY 5 - 20 - 09

This document provides guidelines for understanding and applying the Entity-Relationship (ER) model in database design, covering topics such as database schemas, data abstraction, and ER modeling concepts. It outlines the different levels of data abstraction, including conceptual, logical, and physical schemas, and explains the characteristics of entities, attributes, and relationships. Additionally, it discusses the importance of data modeling techniques and the conversion of ER models to relational tables.

Uploaded by

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

Quality Content for Outcome based Learning

E R MODEL
Unit 2 Day 5

Ver. No.: 1.1 Copyright © 2021, ABES Engineering College


General Guideline
© (2021) ABES Engineering College.

This document contains valuable confidential and proprietary information of ABESEC. Such confidential and
proprietary information includes, amongst others, proprietary intellectual property which can be legally protected and
commercialized. Such information is furnished herein for training purposes only. Except with the express prior
written permission of ABESEC, this document and the information contained herein may not be published,
disclosed, or used for any other purpose.

2
Copyright © 2021, ABES Engineering College
Topics Covered

Day 5 Day 6 Day 7 Day 8


• Introduction Case • Constraints on Binary
• Completion of E R
Study-User Relationship Types • Reduction of an E R
• Keys Diagram
Requirement • Reduction of an E R Model to Relational
• Basic Concept of ER • Extended ER Concept tables (Cont.)
Model to Relational • Complete Relational
Model tables
• ER Modelling Model of Case Study
• Entities
• Attributes
• Relationship

3
Copyright © 2021, ABES Engineering College
Session Plan - Day 5

 Database Schema

 Conceptual schema
 Logical schema
 Physical schema
 External level schema/View level schema/Subschema

 ER Modelling

 Entities
 Relationship
 Attributes

4
Copyright © 2021, ABES Engineering College
Module Objective

Describe use and apply data analysis and Modelling Techniques i.e. data modelling

To apply Binary Relationship Constraints

Describe the fundamental Elements of ER Model

To understand the concept of Keys

To Explain the Extended E- R concepts

Convert the ER model to relational table in populated relation


database
5
Copyright © 2021, ABES Engineering College
Quality Content for Outcome based Learning

Introduction to Database Schema

Ver. No.: 1.1 Copyright © 2021, ABES Engineering College


Introduction

 Software applications are created to manage data and to help transform data into information.

 A database design is an essential component of any application development .

 Database designing is a necessary step in the process of creating any complex software.

7
Copyright © 2021, ABES Engineering College
Database Schema

The overall design of the database of an organization is called a schema.

Database schemas are the blueprints that help developers visualize how databases should be built.

Example – Vehicle Schema

In the given example , a


schema has been represented
in a diagram for vehicle
sales

8
Copyright © 2021, ABES Engineering College
Data Abstraction

Data Abstraction refers to the process of hiding irrelevant details from the user.

Example: When we send mail through Gmail , we need not to know the details of the server located.
This detail is irrelevant for the mail sender.

 Data Abstraction is divided into 3 levels to achieve Data Independence.


 Data Independence means users and data should not directly interact with each other.

Three levels of Data Abstraction are:


1) View level
2) Conceptual Level
3) Physical Level

9
Copyright © 2021, ABES Engineering College
Schema at different levels

The schemas defined at various level of Data Abstraction are:

 Conceptual schema
 Logical schema
 Physical schema
 External level schema/View level schema/Subschema

10
Copyright © 2021, ABES Engineering College
Conceptual Schema
The conceptual schema design provides:

 high-level data model.


 a conceptual framework to specify the data requirements of the database users
 how the database will be structured to fulfil these requirements.

Conceptual schema or conceptual data model:


The schema/model developed at the conceptual design phase provides a detailed overview of the
enterprise.

It describes:
1. the things of significance to an organization (entity types),
2. its characteristics (attributes),
3. the associations between pairs of those things of significance (relationships).
Ex: ER Model

11
Copyright © 2021, ABES Engineering College
Logical Schema
It is a database design at conceptual level of the data abstraction

In Logical Schema Design:


 The conceptual schema is transformed from the high-level data model into the implementation
data model.
 It defines how the database should be implemented using a specific DBMS.
 This schema defines all the logical constraints that need to be applied to the data stored in the
database.

Steps:
1. Select Data Model ; ex: Relational , Object , Network , Hierarchical etc.
2. Transform Conceptual Model into selected Data Model ex: ER to Relational
3. Implement all constraints as per selected data model.

12
Copyright © 2021, ABES Engineering College
Physical Schema

Physical Schema is the database design at the physical level of data abstraction.

It describes how the data is organized in files, internal storage structure, and access paths.

The logical schema is mapped to the physical schema using DBMS tools selected as per selection of
data models in logical schema phase.

For Example : For RDMBS tools like Microsoft SQL Server, Oracle SQL, or IBM's DB2 etc.

13
Copyright © 2021, ABES Engineering College
View Schema or External Schema

It defines the design of the database at the view level of the data abstraction.

 It defines how an end-user will interact with the database system.


 There are many view schema for a database system. Each view schema defines the view of data
for a particular group of people.
 It shows only those data to a view group in which they are interested and hides the remaining
details.

Example: For Car seller , only selling details are available at view level
For HR , only employee information is available at view level

14
Copyright © 2021, ABES Engineering College
Data Modelling Process

Data modeling is a technique to define and organize the data requirements of


an enterprise.
The process of data modelling is represented in the diagram:

15
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. ____________ means to hide certain details of how data is stored and maintain.

A. Data Isolation

B. Data Integrity

C. Data Abstraction

D. None of these

16
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. In data abstraction which is lowest level of abstraction ?

A. Physical Level

B. Conceptual Level

C. View Level

D. None of these

17
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. ______ of abstraction explains how data is actually stored and describes the Data
Structure and Access methods used by database.

A. Conceptual Level

B. Physical Level

C. View Level

18
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. There are _________ levels of data abstraction.

A. 2

B. 3

C. 4

D. 1

19
Copyright © 2021, ABES Engineering College
Can you answer ?
Q. Which one is correct statement?

Logical data independence provides following without changing application


programs:
(i) Changes in access methods.
(ii) Adding new entities in database
(iii) Splitting an existing record into two or more records
(iv) Changing storage medium

(A) (i) and (ii) (B) (iv) only


(C) (i) and (iv) (D) (ii) and (iii)

20
Copyright © 2021, ABES Engineering College
ER Modelling Introduction

 The entity-relationship (ER) data model is based on a perception of a real-world that


consists of a collection of basic objects, called entities, and of relationships among
these objects.

 Entities are described by a set of attributes.

 The entity-relationship (ER) data model describes data as entities, attributes and
relationships

The database design created using these graphical symbols is referred to as


Entity-Relationship Diagram or E-R Diagram or simply ERD.

21
Copyright © 2021, ABES Engineering College
ER Modelling Introduction
Example of a ER Diagram showing Entity , Attribute and Relationship

22
Copyright © 2021, ABES Engineering College
Entities
An entity is a real-world object which can be a person, place, or thing that can be uniquely
identified and distinguished from other objects.

Example : Student , Department , Country , Car , Course etc.

Entities are of two type:


1) Tangible: That exist in the real world physically, e.g., STUDENT, CAR, etc.
2) Intangible: That exist only logically and have no physical existence, e.g., COURSE, DEPARTMENT, etc.

In ER Diagram entities represented in RECTANGLULAR BOX

Example : Student Entity Car Entity

Student Car

23
Copyright © 2021, ABES Engineering College
Entity Type

 An entity type defines the set of entities having a common set of attributes.

 Each entity type is defined by its name and attributes.

Example: All the students in a college or university will have the same set of attributes, then
STUDENT becomes entity type.

24
Copyright © 2021, ABES Engineering College
Entity Set

 The collection of entities of a particular entity type in the database is called an entity set at any
point in time.

 It is also called the extension of the entity type.

 Example:
Entity Type: STUDENT
Entity Set:

25
Copyright © 2021, ABES Engineering College
Entity Instance

 A single occurrence of an entity is called an entity instance.

26
Copyright © 2021, ABES Engineering College
Attributes

 Every entity has a set of properties that describes the


entity.

 For example, a student can have attributes like roll


number, first name, middle name, last name, date of
birth, gender.

 Attributes are represented in oval shape attached to


the entity.

27
Copyright © 2021, ABES Engineering College
Types of Attributes

The attributes of an entity can be different types:

 General Attribute or Attribute


 Key Attribute
 Multivalued attribute
 Composite Attribute
 Derived Attribute

28
Copyright © 2021, ABES Engineering College
Types of Attributes (Cont.)

Key Attributes -

 The attributes which help in the unique identification of


entities are called key attributes.

 Such attributes have unique values, e.g., roll_no of a


STUDENT, course_id of a COURSE, and dept_id of a
DEPARTMENT are the key attributes.

 While representing such attributes, we need to underline


them.

29
Copyright © 2021, ABES Engineering College
Types of Attributes (Cont.)

Multivalued attribute –

 The attribute which can have multiple values for an


entity type is called a multivalued attribute.

 Example: A STUDENT can have multiple phone


numbers using attribute phone no.

 Use double line oval to represent the multi-values


attribute.

30
Copyright © 2021, ABES Engineering College
Types of Attributes (Cont.)

Composite Attribute –

 An attribute composed of multiple sub-attributes is called a composite attribute. Example: The


address attribute can be divided into five sub-attributes house_no, street_name.

 Use rounded brackets to represent such attributes inside the oval shape.

31
Copyright © 2021, ABES Engineering College
Types of Attributes (Cont.)

Derived Attribute –

 An attribute whose value is


calculated from another attribute(s)
is called a derived attribute,

Example: age attribute can also be derived


from another attribute, dob (date of birth).

 Use dotted line oval shape to


represent a derived attribute.

32
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. ER modeling is primarily used for _________.

A. Database Programming
B. Organizing Databases
C. Designing Databases
D. None of the above

33
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. Entity is a _________

A. Object of relation
B. Present working model
C. Thing in real world
D. Model of relation

34
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. An Entity Set is

A. a set of entities of the same type that share the same properties
B. a set of entities of different type that share the same properties
C. a set of entities of different type that share the different properties
D. None of the above

35
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. An attribute which can have many values for a single entity is called as

A. Composite Attribute
B. Descriptive Attribute
C. Derived Attribute
D. Multivalued Attribute

36
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. Which of the following can be a multivalued attribute?

A. Phone_number
B. Name
C. Date_of_birth
D. All of the mentioned

37
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. The attribute name could be structured as an attribute consisting of first name,


middle initial, and last name. This type of attribute is called

A. Simple attribute
B. Composite attribute
C. Multivalued attribute
D. Derived attribute

38
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. The first step in database design is

A. Physical Database Design


B. Logical Database Design
C. Conceptual Database Design
D. Requirements Gathering and Analysis

39
Copyright © 2021, ABES Engineering College
Type of Entity Types

Entity Type can be of two types:

 Regular (Strong) Entity Type

 Weak Entity Type

40
Copyright © 2021, ABES Engineering College
Strong Entity Type

 Strong Entity Type are those entity types


that have a key attribute(s).

 A rectangle in the ER diagram represents


a strong entity type.

Representation of Strong Entity (STUDENT)

41
Copyright © 2021, ABES Engineering College
Weak Entity Type
An entity type may not have a key attribute(s) to uniquely identify each entity
instance. Such an entity type is termed as a weak entity type.

Example : Section (As section does not have its own key attribute) , so section is a weak entity set.

 Weak Entity must be associated with another entity type, called the identifying or owner entity
type.

Example: Department is the owner/identifying entity type of Section

 A weak entity type has a partial key, which is the attribute that can uniquely identify weak
entities that are related to the same owner entity.

Example: Section_name is the partial key of the Section weak entity as a section name uniquely identifies
one single section for that department.

42
Copyright © 2021, ABES Engineering College
Weak Entity Type (Cont.)

Representation of Weak Entity in ERD:

 A double outlined rectangle represents


a weak entity type.

 The partial key is represented by a


dotted underline

Example: Section and section_name in


the diagram

Representation of Weak Entity (SECTION)

43
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. An entity type whose existence depends on other entity type ________.

A. Strong
B. Weak
C. Dependent
D. Variant

44
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. Weak entity set is represented as

A. Underline
B. Double line
C. Double diamond
D. Double rectangle

45
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. For a weak entity set to be meaningful, it must be associated with another


entity set, called the

A. Identifying set
B. Owner set
C. Neighbour set
D. Strong entity set

46
Copyright © 2021, ABES Engineering College
Relationship
 When two or more entity types are linked together to manage the related information, such
linkage is called relationship.

 Example: Every STUDENT belongs to a DEPARTMENT. These two entities have a relationship.

 Use a diamond symbol to create the relationship between the entity types.

47
Copyright © 2021, ABES Engineering College
Relationship (Cont.)

Representation of Relationship (BELONGS TO)

48
Copyright © 2021, ABES Engineering College
Relationship Type
 When two or more entity types are linked together to manage the related information, then such
linkage is called a relationship type.

 Example: Every STUDENT belongs to a DEPARTMENT. These two entities have a relationship
type – "BELONGS TO“

 Use the diamond symbol to create the relationship type between the entity types.

49
Copyright © 2021, ABES Engineering College
Relationship instance and a Relationship Set
 A relationship instance is an instance that associates an entity instance from an entity type to
another entity instance of another entity type to establish a relationship among various
participating entity types.

 A relationship set is the set of all relationship instances that participates in any relationship type
to define a relationship between various participating entity types.

50
Copyright © 2021, ABES Engineering College
Relationship Degree
 The degree of a relationship type is the number of participating entity types. Hence, the
BELONGS TO relationship is of degree two has only two participating entity types, i.e.,
STUDENT and DEPARTMENT.

 A relationship of degree two is called binary. A relationship type with degree three is called a
ternary relationship.

ER diagram with a ternary relationship (COURSE ALLOCATION)

51
Copyright © 2021, ABES Engineering College
Role Names and Recursive Relationships

The role name signifies the role that a participating entity from the entity type plays in each
relationship instance and helps to explain what the relationship means.

Example- In the BELONGS TO relationship type, STUDENT plays the role of a student, and
DEPARTMENT plays the role of an academic department.

 The role name becomes essential when the same entity type participates more than once in a relationship
type in different roles.
 Such relationship types are called recursive relationships.

52
Copyright © 2021, ABES Engineering College
Role Names and Recursive Relationships (Cont.)
Example:
 The WORKS FOR relationship type is a recursive relationship type.
 It relates HOD and faculty entity type.
 HOD and faculty entities are members of the same FACULTY entity set.
 The faculty entity type participates twice in WORKS FOR, once in the role of a FACULTY and other in the
role of a HOD.

53
Copyright © 2021, ABES Engineering College
Attribute attached to a relationship type
 A relationship type can also have attributes attached with it which are called descriptive
attributes.

ER diagram of attribute attached with to a relationship type

54
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. A relationship is an association between

A. Two or more Entities


B. One or more Entities
C. Entities and Attributes
D. One or more Attributes

55
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. The function that an entity plays in a relationship is called that entity’s _________

A. Participation
B. Position
C. Role
D. Instance

56
Copyright © 2021, ABES Engineering College
Can you answer ?

Q. We indicate roles in E-R diagrams by labeling the lines that connect


___________ to __________

A. Diamond , diamond
B. Rectangle, diamond
C. Rectangle, rectangle
D. Diamond, rectangle

57
Copyright © 2021, ABES Engineering College
Thank You

58
Copyright © 2021, ABES Engineering College

You might also like