SlideShare a Scribd company logo
1 of 47
1
Entity Relationship Modeling
Objectives:
• To illustrate how relationships between entities are defined and refined.
• To know how relationships are incorporated into the database design
process.
• To describe how ERD components affect database design and
implementation.
2
Entity-Relationship (ER) Modeling.
• Entity Relationship (ER) Diagram
– A detailed, logical representation of the entities,
associations and data elements for an organization or
business
• Notation uses three main constructs
– Data entities
– Relationships
– Attributes Chen Model &
Crow’s Foot
Model
Person, place, object, event
or concept about which data
is to be maintained
named property or
characteristic of an
entity
Association
between the
instances of one or
more entity types
Represents a set or collection of
objects in the real world that
share the same properties
Chen Notation
EntityName Verb Phrase AttributeName
Crow’s Foot Notation
EntityName
Entity Attribute
EntityName
List of
Attributes
Relationship
Verb phrase
5
2.1 Entities
• Examples of entities:
– Person: EMPLOYEE, STUDENT, PATIENT
– Place: STORE, WAREHOUSE
– Object: MACHINE, PRODUCT, CAR
– Event: SALE,REGISTRATION, RENEWAL
– Concept: ACCOUNT, COURSE
• Guidelines for naming and defining entity types:
– An entity type should be descriptive and specific
– An entity name should be concise
– Event entity types should be named for the result of the event, not
the activity or process of the event.
6
2.2 Attributes
• Example of entity types and associated attributes:
STUDENT: Student_ID, Student_Name, Home_Address,
Phone_Number, Major
• Guidelines for naming attributes:
– An attribute name is a noun.
– An attribute name should be unique
– To make an attribute name unique and clear, each attribute name
should follow a standard format
– Similar attributes of different entity types should use similar but
distinguishing names.
7
Example
Staff
StaffID
Name Gender
IC
Staff
StaffID
Name
Gender
IC
PK
8
2.3 Relationships
 Associations between instances of one or more entity types that is of interest
 Given a name that describes its function.
• relationship name is an active or a passive verb.
Author Book
Relationship name:
writes
An author writes one or more books
A book can be written by one or more authors.
9
2.3.1 Degree of Relationships
• Degree: number of entity types that participate in a relationship
• Three cases
– Unary: between two instances of one entity type
– Binary: between the instances of two entity types
– Ternary: among the instances of three entity types
10
main components and its symbols in
ER Diagrams:
Following are the main components and its symbols in ER Diagrams:
•Rectangles: This Entity Relationship Diagram symbol represents entity types
•Ellipses : Symbol represent attributes
•Diamonds: This symbol represents relationship types
•Lines: It links attributes to entity types and entity types with other relationship types
•Primary key: attributes are underlined
•Double Ellipses: Represent multi-valued attributes
11
Attribute
• An attribute describes the property of an
entity. An attribute is represented as Oval in
an ER diagram. There are four types of
attributes:
• 1. Key attribute
2. Composite attribute
3. Multivalued attribute
4. Derived attribute
12
key attribute
• A key attribute can uniquely identify an entity
from an entity set. For example, student roll
number can uniquely identify a student from a
set of students. Key attribute is represented by
oval same as other attributes however the text
of key attribute is underlined.
13
composite attribute
An attribute that is a combination of other attributes is known as composite
attribute. For example, In student entity, the student address is a composite
attribute as an address is composed of other attributes such as pin code, state,
country.
14
Multivalued attribute:
• An attribute that can hold multiple values is
known as multivalued attribute. It is
represented with double ovals in an ER
Diagram. For example – A person can have
more than one phone numbers so the
phone number attribute is multivalued.
15
4. Derived attribute:
• A derived attribute is one whose value is
dynamic and derived from another attribute.
It is represented by dashed oval in an ER
Diagram. For example – Person age is a
derived attribute as it changes over time
and can be derived from another attribute
(Date of birth).
16
Participation Constraints
• Total Participation − Each entity is involved in the
relationship. Total participation is represented by double
lines.
• Partial participation − Not all entities are involved in the
relationship. Partial participation is represented by single
lines.
17
• A relationship where two entities are
participating is called a binary relationship.
Cardinality is the number of instance of an
entity from a relation that can be associated
with the relation.
18
One-to-one −
• When only one instance of an entity is
associated with the relationship, it is marked
as '1:1'.
19
One-to-many
• One-to-many − When more than one
instance of an entity is associated with a
relationship, it is marked as '1:N'.
20
Many-to-one
• Many-to-one − When more than one
instance of entity is associated with the
relationship, it is marked as 'N:1'.
21
Many-to-many
• Many-to-many − The following image
reflects that more than one instance of an
entity on the left and more than one instance
of an entity on the right can be associated
with the relationship. It depicts many-to-
many relationship.
•
22
2.4 Cardinality and Connectivity
• Relationships can be classified as either
• one – to – one
• one – to – many
• many – to –many
• Cardinality : minimum and maximum number of
instances of Entity B that can (or must be)
associated with each instance of entity A.
Connectivity
23
2.4.1 Connectivity
• Chen Model
– 1 to represent one.
– M to represent many
• Crow’s Foot
many
One
One or many
1
M
Mandatory one , means (1,1)
Optional? – we’ll see after this
24
2.4 Cardinality and Connectivity
Professor Class
teaches
A professor teaches class OR
A class is taught by professor
How Many??
Professor Class
teaches
25
Strong Entity
• Strong Entity is independent to any other
entity in the schema.
• A strong entity always have a primary key. In
ER diagram, a strong entity is represented
by rectangle.
• Relationship between two strong entities is
represented by a diamond.
• A set of strong entities is known as strong
entity set.
26
27
Weak Entity
• Weak entity is dependent on strong entity
and cannot exists without a corresponding
strong.
• It has a foreign key which relates it to a
strong entity. A weak entity is represented by
double rectangle.
• Relationship between a strong entity and a
weak entity is represented by double
diamond. The foreign key is also called a
partial discriminator key.
28
29
Strong Entity Set Weak Entity Set
Strong entity set always has a primary key.
It does not have enough attributes to build a
primary key.
It is represented by a rectangle symbol. It is represented by a double rectangle symbol.
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 set.
The member of a weak entity set called as a
subordinate entity set.
Primary Key is one of its attributes which helps to
identify its member.
In a weak entity set, it is a combination of primary
key and partial key of the strong entity set.
In the ER diagram the relationship between two
strong entity set shown by using a diamond
symbol.
The relationship between one strong and a weak
entity set shown by using the double diamond
symbol.
The connecting line of the strong entity set with the
relationship is single.
The line connecting the weak entity set for
identifying relationship is double.
Comparing Strong Entity and weak Entity
30
What are Keys in DBMS?
• KEYS in DBMS is an attribute or set of
attributes which helps you to identify a
row(tuple) in a relation(table).
• They allow you to find the relation between
two tables.
• Key is also helpful for finding unique record
or row from the table. Database key is also
helpful for finding unique record or row from
the table.
31
Employee ID FirstName LastName
11 Andrew Johnson
22 Tom Wood
33 Alex Hale
32
Types of Keys in DBMS (Database
Management System)
33
Example
34
Primary Key
Primary Key: There can be more than one candidate key in relation out of which
one can be chosen as the primary key. For Example, STUD_NO, as well as
STUD_PHONE both, are candidate keys for relation STUDENT but STUD_NO can
be chosen as the primary key (only one out of many candidate keys).
35
Candidate Key:
• The minimal set of attributes that can
uniquely identify a tuple is known as
a candidate key.
• For Example, STUD_NO in STUDENT
relation.
• The candidate key can be simple (having
only one attribute) or composite as well. For
Example, {STUD_NO, COURSE_NO} is a
composite candidate key for relation
36
• Super Key: The set of attributes that can
uniquely identify a tuple is known as Super
Key. For Example, STUD_NO, (STUD_NO,
STUD_NAME), etc.
• Adding zero or more attributes to the
candidate key generates the super key.
• A candidate key is a super key but vice
versa is not true.
37
Alternate Key:
• The candidate key other than the primary
key is called an alternate key.
• For Example, STUD_NO, as well as
STUD_PHONE both, are candidate keys for
relation STUDENT but STUD_PHONE will
be an alternate key (only one out of many
candidate keys).
38
Foreign keys
• Foreign keys are the column of the table
which is used to point to the primary key of
another table.
39
Composite Key
• A composite key is a key that contains two
or more attributes that help to identify a
record in the table uniquely.
• we have to use this combination to identify
the records separately. It is not possible to
use individual attributes to identify the
records.
40
• For example, assume that there is a table to store
the marks of the students.
• It has 4 attributes or columns: student_id,
subject_id, marks and exam_name.
• In this table, we cannot consider either the
student_id or the subject_id as the primary key
because we cannot uniquely identify the records
by using them. However, we can identify each
record by using the combination of student_id and
subject_id. Therefore, this combination is
the primary key. Furthermore, this combination is
also a composite key.
41
Candidate Key vs Composite key
42
Surrogate key
Surrogate key also called a synthetic primary
key, is generated when a new record is
inserted into a table automatically by a
database that can be declared as the primary
key of that table . It is the sequential number
outside of the database that is made available
to the user and the application or it acts as an
object that is present in the database but is
not visible to the user or application.
43
Example
Suppose we have two tables of two different
schools having the same column registration_no
, name and percentage , each table having its
own natural primary key, that is registration_no.
Table A Table B
registration_n
o
name percentage
CS107 Taylor 49
CS108 Simon 86
CS109 Sam 96
CS110 Andy 58
registration_n
o
name percentage
210101 Harry 90
210102 Maxwell 65
210103 Lee 87
210104 Chris 76
44
Now, suppose we want to merge the details of both the schools in a single table
.
Resulting table will be –
45
Application of DBMS
46
Sectorsssss Use of DBMS
Banking For customer information, account activities,
payments, deposits, loans, etc.
Airlines For reservations and schedule information.
Universities For student information, course registrations,
colleges and grades.
Telecommunication It helps to keep call records, monthly bills,
maintaining balances, etc.
Finance For storing information about stock, sales, and
purchases of financial instruments like stocks
and bonds.
Sales Use for storing customer, product & sales
information.
Manufacturing It is used for the management of supply chain
and for tracking production of items. Inventories
status in warehouses.
HR Management For information about employees, salaries,
payroll, deduction, generation of paychecks,
etc.
47
~The END~
Q & A

More Related Content

Similar to ERD(2).ppt

ER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMSER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMSRubal Sagwal
 
entityrelationshipmodel.pptx
entityrelationshipmodel.pptxentityrelationshipmodel.pptx
entityrelationshipmodel.pptxThangamaniR3
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship ModelSlideshare
 
Entityrelationshipmodel
EntityrelationshipmodelEntityrelationshipmodel
EntityrelationshipmodelEnes Bolfidan
 
Entity Relationship Diagram – ER Diagram in DBMS.pptx
Entity Relationship Diagram – ER Diagram in DBMS.pptxEntity Relationship Diagram – ER Diagram in DBMS.pptx
Entity Relationship Diagram – ER Diagram in DBMS.pptxsukrithlal008
 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptxsandeep54552
 
18306_lec-2 (1).ppt
18306_lec-2 (1).ppt18306_lec-2 (1).ppt
18306_lec-2 (1).pptIshuIswarya3
 
Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..Nimrakhan89
 

Similar to ERD(2).ppt (20)

ER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMSER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMS
 
ER-Model-ER Diagram
ER-Model-ER DiagramER-Model-ER Diagram
ER-Model-ER Diagram
 
Data Models.pptx
Data Models.pptxData Models.pptx
Data Models.pptx
 
entityrelationshipmodel.pptx
entityrelationshipmodel.pptxentityrelationshipmodel.pptx
entityrelationshipmodel.pptx
 
Day 1 SQL.pptx
Day 1 SQL.pptxDay 1 SQL.pptx
Day 1 SQL.pptx
 
SQL.pptx
SQL.pptxSQL.pptx
SQL.pptx
 
Er model
Er modelEr model
Er model
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
Revision ch 3
Revision ch 3Revision ch 3
Revision ch 3
 
Entityrelationshipmodel
EntityrelationshipmodelEntityrelationshipmodel
Entityrelationshipmodel
 
Entity Relationship Diagram – ER Diagram in DBMS.pptx
Entity Relationship Diagram – ER Diagram in DBMS.pptxEntity Relationship Diagram – ER Diagram in DBMS.pptx
Entity Relationship Diagram – ER Diagram in DBMS.pptx
 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptx
 
ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
 
18306_lec-2 (1).ppt
18306_lec-2 (1).ppt18306_lec-2 (1).ppt
18306_lec-2 (1).ppt
 
ER-Diagram.pptx
ER-Diagram.pptxER-Diagram.pptx
ER-Diagram.pptx
 
Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..
 
Unit iv dbms
Unit   iv dbmsUnit   iv dbms
Unit iv dbms
 
er-models.pptx
er-models.pptxer-models.pptx
er-models.pptx
 
rdbmsdol.pptx
rdbmsdol.pptxrdbmsdol.pptx
rdbmsdol.pptx
 
rdbmsdol.pptx
rdbmsdol.pptxrdbmsdol.pptx
rdbmsdol.pptx
 

Recently uploaded

ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 

Recently uploaded (20)

ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 

ERD(2).ppt

  • 1. 1 Entity Relationship Modeling Objectives: • To illustrate how relationships between entities are defined and refined. • To know how relationships are incorporated into the database design process. • To describe how ERD components affect database design and implementation.
  • 2. 2 Entity-Relationship (ER) Modeling. • Entity Relationship (ER) Diagram – A detailed, logical representation of the entities, associations and data elements for an organization or business • Notation uses three main constructs – Data entities – Relationships – Attributes Chen Model & Crow’s Foot Model
  • 3. Person, place, object, event or concept about which data is to be maintained named property or characteristic of an entity Association between the instances of one or more entity types Represents a set or collection of objects in the real world that share the same properties Chen Notation EntityName Verb Phrase AttributeName
  • 4. Crow’s Foot Notation EntityName Entity Attribute EntityName List of Attributes Relationship Verb phrase
  • 5. 5 2.1 Entities • Examples of entities: – Person: EMPLOYEE, STUDENT, PATIENT – Place: STORE, WAREHOUSE – Object: MACHINE, PRODUCT, CAR – Event: SALE,REGISTRATION, RENEWAL – Concept: ACCOUNT, COURSE • Guidelines for naming and defining entity types: – An entity type should be descriptive and specific – An entity name should be concise – Event entity types should be named for the result of the event, not the activity or process of the event.
  • 6. 6 2.2 Attributes • Example of entity types and associated attributes: STUDENT: Student_ID, Student_Name, Home_Address, Phone_Number, Major • Guidelines for naming attributes: – An attribute name is a noun. – An attribute name should be unique – To make an attribute name unique and clear, each attribute name should follow a standard format – Similar attributes of different entity types should use similar but distinguishing names.
  • 8. 8 2.3 Relationships  Associations between instances of one or more entity types that is of interest  Given a name that describes its function. • relationship name is an active or a passive verb. Author Book Relationship name: writes An author writes one or more books A book can be written by one or more authors.
  • 9. 9 2.3.1 Degree of Relationships • Degree: number of entity types that participate in a relationship • Three cases – Unary: between two instances of one entity type – Binary: between the instances of two entity types – Ternary: among the instances of three entity types
  • 10. 10 main components and its symbols in ER Diagrams: Following are the main components and its symbols in ER Diagrams: •Rectangles: This Entity Relationship Diagram symbol represents entity types •Ellipses : Symbol represent attributes •Diamonds: This symbol represents relationship types •Lines: It links attributes to entity types and entity types with other relationship types •Primary key: attributes are underlined •Double Ellipses: Represent multi-valued attributes
  • 11. 11 Attribute • An attribute describes the property of an entity. An attribute is represented as Oval in an ER diagram. There are four types of attributes: • 1. Key attribute 2. Composite attribute 3. Multivalued attribute 4. Derived attribute
  • 12. 12 key attribute • A key attribute can uniquely identify an entity from an entity set. For example, student roll number can uniquely identify a student from a set of students. Key attribute is represented by oval same as other attributes however the text of key attribute is underlined.
  • 13. 13 composite attribute An attribute that is a combination of other attributes is known as composite attribute. For example, In student entity, the student address is a composite attribute as an address is composed of other attributes such as pin code, state, country.
  • 14. 14 Multivalued attribute: • An attribute that can hold multiple values is known as multivalued attribute. It is represented with double ovals in an ER Diagram. For example – A person can have more than one phone numbers so the phone number attribute is multivalued.
  • 15. 15 4. Derived attribute: • A derived attribute is one whose value is dynamic and derived from another attribute. It is represented by dashed oval in an ER Diagram. For example – Person age is a derived attribute as it changes over time and can be derived from another attribute (Date of birth).
  • 16. 16 Participation Constraints • Total Participation − Each entity is involved in the relationship. Total participation is represented by double lines. • Partial participation − Not all entities are involved in the relationship. Partial participation is represented by single lines.
  • 17. 17 • A relationship where two entities are participating is called a binary relationship. Cardinality is the number of instance of an entity from a relation that can be associated with the relation.
  • 18. 18 One-to-one − • When only one instance of an entity is associated with the relationship, it is marked as '1:1'.
  • 19. 19 One-to-many • One-to-many − When more than one instance of an entity is associated with a relationship, it is marked as '1:N'.
  • 20. 20 Many-to-one • Many-to-one − When more than one instance of entity is associated with the relationship, it is marked as 'N:1'.
  • 21. 21 Many-to-many • Many-to-many − The following image reflects that more than one instance of an entity on the left and more than one instance of an entity on the right can be associated with the relationship. It depicts many-to- many relationship. •
  • 22. 22 2.4 Cardinality and Connectivity • Relationships can be classified as either • one – to – one • one – to – many • many – to –many • Cardinality : minimum and maximum number of instances of Entity B that can (or must be) associated with each instance of entity A. Connectivity
  • 23. 23 2.4.1 Connectivity • Chen Model – 1 to represent one. – M to represent many • Crow’s Foot many One One or many 1 M Mandatory one , means (1,1) Optional? – we’ll see after this
  • 24. 24 2.4 Cardinality and Connectivity Professor Class teaches A professor teaches class OR A class is taught by professor How Many?? Professor Class teaches
  • 25. 25 Strong Entity • Strong Entity is independent to any other entity in the schema. • A strong entity always have a primary key. In ER diagram, a strong entity is represented by rectangle. • Relationship between two strong entities is represented by a diamond. • A set of strong entities is known as strong entity set.
  • 26. 26
  • 27. 27 Weak Entity • Weak entity is dependent on strong entity and cannot exists without a corresponding strong. • It has a foreign key which relates it to a strong entity. A weak entity is represented by double rectangle. • Relationship between a strong entity and a weak entity is represented by double diamond. The foreign key is also called a partial discriminator key.
  • 28. 28
  • 29. 29 Strong Entity Set Weak Entity Set Strong entity set always has a primary key. It does not have enough attributes to build a primary key. It is represented by a rectangle symbol. It is represented by a double rectangle symbol. 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 set. The member of a weak entity set called as a subordinate entity set. Primary Key is one of its attributes which helps to identify its member. In a weak entity set, it is a combination of primary key and partial key of the strong entity set. In the ER diagram the relationship between two strong entity set shown by using a diamond symbol. The relationship between one strong and a weak entity set shown by using the double diamond symbol. The connecting line of the strong entity set with the relationship is single. The line connecting the weak entity set for identifying relationship is double. Comparing Strong Entity and weak Entity
  • 30. 30 What are Keys in DBMS? • KEYS in DBMS is an attribute or set of attributes which helps you to identify a row(tuple) in a relation(table). • They allow you to find the relation between two tables. • Key is also helpful for finding unique record or row from the table. Database key is also helpful for finding unique record or row from the table.
  • 31. 31 Employee ID FirstName LastName 11 Andrew Johnson 22 Tom Wood 33 Alex Hale
  • 32. 32 Types of Keys in DBMS (Database Management System)
  • 34. 34 Primary Key Primary Key: There can be more than one candidate key in relation out of which one can be chosen as the primary key. For Example, STUD_NO, as well as STUD_PHONE both, are candidate keys for relation STUDENT but STUD_NO can be chosen as the primary key (only one out of many candidate keys).
  • 35. 35 Candidate Key: • The minimal set of attributes that can uniquely identify a tuple is known as a candidate key. • For Example, STUD_NO in STUDENT relation. • The candidate key can be simple (having only one attribute) or composite as well. For Example, {STUD_NO, COURSE_NO} is a composite candidate key for relation
  • 36. 36 • Super Key: The set of attributes that can uniquely identify a tuple is known as Super Key. For Example, STUD_NO, (STUD_NO, STUD_NAME), etc. • Adding zero or more attributes to the candidate key generates the super key. • A candidate key is a super key but vice versa is not true.
  • 37. 37 Alternate Key: • The candidate key other than the primary key is called an alternate key. • For Example, STUD_NO, as well as STUD_PHONE both, are candidate keys for relation STUDENT but STUD_PHONE will be an alternate key (only one out of many candidate keys).
  • 38. 38 Foreign keys • Foreign keys are the column of the table which is used to point to the primary key of another table.
  • 39. 39 Composite Key • A composite key is a key that contains two or more attributes that help to identify a record in the table uniquely. • we have to use this combination to identify the records separately. It is not possible to use individual attributes to identify the records.
  • 40. 40 • For example, assume that there is a table to store the marks of the students. • It has 4 attributes or columns: student_id, subject_id, marks and exam_name. • In this table, we cannot consider either the student_id or the subject_id as the primary key because we cannot uniquely identify the records by using them. However, we can identify each record by using the combination of student_id and subject_id. Therefore, this combination is the primary key. Furthermore, this combination is also a composite key.
  • 41. 41 Candidate Key vs Composite key
  • 42. 42 Surrogate key Surrogate key also called a synthetic primary key, is generated when a new record is inserted into a table automatically by a database that can be declared as the primary key of that table . It is the sequential number outside of the database that is made available to the user and the application or it acts as an object that is present in the database but is not visible to the user or application.
  • 43. 43 Example Suppose we have two tables of two different schools having the same column registration_no , name and percentage , each table having its own natural primary key, that is registration_no. Table A Table B registration_n o name percentage CS107 Taylor 49 CS108 Simon 86 CS109 Sam 96 CS110 Andy 58 registration_n o name percentage 210101 Harry 90 210102 Maxwell 65 210103 Lee 87 210104 Chris 76
  • 44. 44 Now, suppose we want to merge the details of both the schools in a single table . Resulting table will be –
  • 46. 46 Sectorsssss Use of DBMS Banking For customer information, account activities, payments, deposits, loans, etc. Airlines For reservations and schedule information. Universities For student information, course registrations, colleges and grades. Telecommunication It helps to keep call records, monthly bills, maintaining balances, etc. Finance For storing information about stock, sales, and purchases of financial instruments like stocks and bonds. Sales Use for storing customer, product & sales information. Manufacturing It is used for the management of supply chain and for tracking production of items. Inventories status in warehouses. HR Management For information about employees, salaries, payroll, deduction, generation of paychecks, etc.