Module 2
Module 2
Module 2 DataModeling
Dr. V Vani
VIT Chennai,SCOPE
Overview
Entity Relationship Model
Types of Attributes
Relationship
Structural Constraints
Relational Model
Relational model Constraints
Mapping ER model to a relational schema
Integrity constraints
Data Model
A diagram that displays a set of tables and
the relationships between them.
The Importance of Data Model
Blue print: official documentation
Eg. Blue print of house
Attribute:
Attributes are data objects that either
identify or describe entities (property
of an entity).
Attributes:
SS#: “123-45-6789” (single-valued)
Cell Phone: “(661)123-4567, (661)234-5678” (multi-valued)
Name: “Harrison Ford” (composite)
Address: “123 Main Str., LA, CA” (composite)
Gender: “Female” (simple)
Age: 24 (derived)
Participation
2 types:
a. Total
b. Partial
Keys
Key is an attribute or collection of
attributes that uniquely identifies an
entity among entity set.
Super Key
Candidate Key
Primary Key
Symbols used in ERD
Rectangles: This Entity Relationship Diagram
symbol represents entity types.
Ellipses : Symbol represent attributes.
Postin
EID Name
g
Employee
Department
Strong entity set always has a primary key. It does not have enough attributes to build a primary key.
It contains a Primary key represented by the underline symbol. It contains a Partial Key which is represented by a dashed
underline symbol.
The member of a strong entity set is called as dominant entity The member of a weak entity set called as a subordinate entity
set. set.
Primary Key is one of its attributes which helps to identify its In a weak entity set, it is a combination of primary key and
member. partial key of the strong entity set.
In the ER diagram the relationship between two strong entity The relationship between one strong and a weak entity set
set shown by using a diamond symbol. shown by using the double diamond symbol.
The connecting line of the strong entity set with the relationship The line connecting the weak entity set for identifying
is single. relationship is double.
Source:https://www.guru99.com/er-diagram-tutorial-dbms.html
Source:ElmasriNavathae book@2007
Source:ElmasriNavathae book@2007
The (min, max) notation for
relationship constraints
Read the min,max numbers next to the entity type and looking
away from the entity type
Source:ElmasriNavathae book@2007
COMPANY ER Schema Diagram using
(min, max) notation
Source:ElmasriNavathae book@2007
Keys
Key is an attribute or collection of
attributes that uniquely identifies an
entity among entity set.
For example, the roll_number of a
student makes him/her identifiable
among students.
Super Key − A set of attributes (one or more) that
collectively identifies an entity in an entity set.
Candidate Key − A minimal super key is called a candidate
key. An entity set may have more than one candidate key.
Primary Key − A primary key is one of the candidate keys
chosen by the database designer to uniquely identify the
entity set.
ER Model to Relational Schema
ER Model
Steps for converting ER Model to
Relational Schema or Tables
That relation or table will be having key attribute from entity set
which it as attached.
Relational Schema
(for Company ER model)