SlideShare a Scribd company logo
Data Modeling Using
Entity-Relationship (ER) Model
2
Chapter Outline
• Example Database Application (COMPANY)
• ER Model Concepts
– Entities and Attributes
– Entity Types, Value Sets, and Key Attributes
– Relationships and Relationship Types
– Weak Entity Types
– Roles and Attributes in Relationship Types
• ER Diagrams - Notation
• ER Diagram for COMPANY Schema
3
Example COMPANY
Database
• Requirements of the Company
– The company is organized into DEPARTMENTs.
Each department has a name, number and an
employee who manages the department. We keep
track of the start date of the department manager.
– Each department controls a number of PROJECTs.
Each project has a name, number and is located at
a single location.
Example COMPANY Database
(Cont.)
–We store each EMPLOYEE’s social security
number, address, salary, sex, and birthdate. Each
employee works for one department but may work
on several projects. We keep track of the number of
hours per week that an employee currently works
on each project. We also keep track of the direct
supervisor of each employee.
–Each employee may have a number of
DEPENDENTs. For each dependent, we keep track
of their name, sex, birthdate, and relationship to
employee.
EntityEntity
• Entity - Thing which has existence distinguishable from otherEntity - Thing which has existence distinguishable from other
objects (things)objects (things)
 independent existence
described by its attributes (set of properties)
 determined by particular value of its attributes
 can be concrete or abstract
Example
Rama, Raghu
Maker Towers, Hotel Cecil
ER Model Concepts
• Entity
– Entities are specific objects or things in the mini-world that
are represented in the database.
– For example the EMPLOYEE John Smith, the Research
DEPARTMENT, the ProductX PROJECT
• Entity type
– Entities with the same basic attributes are grouped or
typed into an entity type.
– For example, the EMPLOYEE entity type or the PROJECT
entity type.
ER Model Concepts
• Attributes
– Attributes are properties used to describe an entity.
– For example an EMPLOYEE entity may have a Name,
SSN, Address, Sex, BirthDate
– A specific entity will have a value for each of its attributes.
For example a specific employee entity may have
Name='John Smith', SSN='123456789', Address ='731,
Fondren, Houston, TX', Sex='M', BirthDate='09-JAN-55‘
– Each attribute has a value set (or data type) associated
with it – e.g. integer, string, subrange, enumerated type, …
Key Attributes
• An attribute of an entity type for which each entity must
have a unique value is called a key attribute of the entity
type. For example, SSN of EMPLOYEE.
• A key attribute may be composite. For example,
VehicleTagNumber is a key of the CAR entity type with
components (Number, State).
• An entity type may have more than one key. For example,
the CAR entity type may have two keys:
– VehicleIdentificationNumber (popularly called VIN) and
– VehicleTagNumber (Number, State), also known as
license_plate number.
Entity Sets
• An entity set is a set of entities of the same type that
share the same properties.
– Example: set of all persons, companies, trees, holidays
ENTITY SET corresponding to the
ENTITY TYPE CAR
car1
((ABC 123, TEXAS), TK629, Ford Mustang, convertible, 1999, (red, black))
car2
((ABC 123, NEW YORK), WP9872, Nissan 300ZX, 2-door, 2002, (blue))
car3
((VSY 720, TEXAS), TD729, Buick LeSabre, 4-door, 2003, (white, blue))
.
CAR
Registration(RegistrationNumber, State), VehicleID, Make, Model, Year, (Color)
SUMMARY OF ER-DIAGRAM
NOTATION FOR ER SCHEMAS
Meaning
ENTITY TYPE
WEAK ENTITY TYPE
RELATIONSHIP TYPE
IDENTIFYING RELATIONSHIP TYPE
ATTRIBUTE
KEY ATTRIBUTE
MULTIVALUED ATTRIBUTE
COMPOSITE ATTRIBUTE
DERIVED ATTRIBUTE
TOTAL PARTICIPATION OF E2 IN R
CARDINALITY RATIO 1:N FOR E1:E2 IN R
Symbol
E1 R E2
E1 R E2
NN11
Summary of Symbols Used in
E-R Notation
ER DIAGRAM – Entity Types are:
EMPLOYEE, DEPARTMENT, PROJECT, DEPENDENT
Relationship
• A relationship relates two or more distinct entities with a
specific meaning.
• For example, EMPLOYEE John Smith works on the
ProductX PROJECT or EMPLOYEE Franklin Wong
manages the Research DEPARTMENT.
Relationship Type
• Relationships of the same type are grouped or typed into a
relationship type.
• For example, the WORKS_ON relationship type in which
EMPLOYEEs and PROJECTs participate, or the
MANAGES relationship type in which EMPLOYEEs and
DEPARTMENTs participate.
• More than one relationship type can exist with the same
participating entity types.
• For example, MANAGES and WORKS_FOR are distinct
relationships between EMPLOYEE and DEPARTMENT,
but with different meanings and different relationship
instances.
• AA relationship setrelationship set is a class of relationships of the same type,is a class of relationships of the same type,
having common propertieshaving common properties
Attributes of Relationship types
• A relationship type can have attributes; for example,
HoursPerWeek of WORKS_ON; its value for each
relationship instance describes the number of hours per
week that an EMPLOYEE works on a PROJECT.
Attribute of a Relationship Type is:
Hours of WORKS_ON
Structural Constraints –
one way to express semantics of relationships
Cardinality ratio (of a binary relationship): 1:1, 1:N, N:1, or
M:N
SHOWN BY PLACING APPROPRIATE NUMBER ON THE LINK.
Participation constraint (on each participating entity type):
total (called existence dependency) or partial.
SHOWN BY DOUBLE LINING THE LINK
NOTE: These are easy to specify for Binary Relationship Types.
The minimum and maximum values of this connectivity is called the cardinality of
the relationship
Participation of an Entity Set in a Relationship
Set
Total participation (indicated by double line): every entity in the entity set
participates in at least one relationship in the relationship set
E.g. participation of loan in borrower is total
every loan must have a customer associated to it via borrower
Partial participation: some entities may not participate in any relationship in
the relationship set
E.g. participation of customer in borrower is partial
ER DIAGRAM – Relationship Types are:
WORKS_FOR, MANAGES, WORKS_ON, CONTROLS,
SUPERVISION, DEPENDENTS_OF
Roles
• Entity sets of a relationship need not be distinct
• The labels “manager” and “worker” are called roles; they
specify how employee entities interact via the works-for
relationship set.
• Roles are indicated in E-R diagrams by labeling the lines
that connect diamonds to rectangles.
• Role labels are optional, and are used to clarify
semantics of the relationship
Recursive Relationship Type
• Both participants are same entity type in different roles.
• For example, SUPERVISION relationships between
EMPLOYEE (in role of supervisor or boss) and
(another) EMPLOYEE (in role of subordinate or
worker).
• In following figure, first role participation labeled with 1
and second role participation labeled with 2.
• In ER diagram, need to display role names to
distinguish participations.
A RECURSIVE RELATIONSHIP
SUPERVISION
e1
e2
e3
e4
e5
e6
e7
EMPLOYEE
r1
r2
r3
r4
r5
r6
SUPERVISION
2
1
1
2
2
1
1
1
2
1
2
2
Recursive Relationship Type is: SUPERVISION
(participation role names are shown)
Entities that are distinguished by their relationship to another entityEntities that are distinguished by their relationship to another entity
 Weak entity hasWeak entity has partial key or discriminatorpartial key or discriminator ––
 Identify entities related to the same strong entity.Identify entities related to the same strong entity.
Weak EntityWeak Entity
 The primary key = primary key of the strong entity setThe primary key = primary key of the strong entity set
+ discriminator.+ discriminator.
 Do not have a key of their own
PF account of an employee
Engineer of a ship
Weak Entity Types
• A weak entity must participate in an identifying
relationship type with an owner or identifying entity
type
• Entities are identified by the combination of:
– A partial key of the weak entity type
– The particular entity they are related to in the
identifying entity type
Example:
Suppose that a DEPENDENT entity is identified by
the dependent’s first name and birthdate,
and the specific EMPLOYEE that the dependent is
related to.
DEPENDENT is a weak entity type with EMPLOYEE as
its identifying entity type via the identifying relationship
type DEPENDENT_OF
Weak Entity Types
Example:
Suppose that a DEPENDENT entity is identified by the
dependent’s first name and birthdate,
and the specific EMPLOYEE that the dependent is
related to.
DEPENDENT is a weak entity type with EMPLOYEE as
its identifying entity type via the identifying relationship
type DEPENDENT_OF
Weak Entity Type is: DEPENDENT
Identifying Relationship is: DEPENDENTS_OF
These attributes best describe the relationship prescription rather than any
individual entity Doctor, Patient or Medicine.
The identifying relationship is the one which relates the weak entity (dependant) with
the strong entity (Employee) on which it depends.
Id is underlined with a dotted line because it is used to form composite key of
dependent entity along with E#.
Relationships of Higher Degree
Relationship types of degree 2 are called binary
Relationship types of degree 3 are called ternary
and of degree n are called n-ary
In general, an n-ary relationship is not equivalent to
n binary relationships
Example of a ternary
relationship
SUPPLY relationship instance: (s,j,p)
A supplier s supplies part p to project j
Ternary vs Binary Relationship Types
Suppose (s,j), (j,p), and (s,p) participate in the relationships
SUPPLIES, USES, and CAN_SUPPLY, respectively
Is this equivalent to the instance (s,j,p) in ternary relationship?
3 binary
relationships
Example of a ternary relationship
Supplier Project Part
Ace R1 T1
Ace R2 T2
Acme R1 T2
Acme R2 T1
Lowes R1 T1
Lowes R2 T2
Supplier Project
Ace R1
Ace R2
Acme R1
Acme R2
Lowes R1
Lowes R2
Project Part
R1 T1
R1 T2
R2 T1
R2 T2
Supplier Part
Ace T1
Ace T2
Acme T2
Acme T1
Lowes T1
Lowes T2
Ternary Relationships
TAUGHT_DURING and OFFERED_DURING are redundant, but
CAN_TEACH is not redundant
3 binary relationships may represent different info than a single ternary relationship
Cardinality Ratio of Ternary Relationships
1 M
N
There is 1 supplier
for every (project,
part) combination
A supplier can
supply same part to
more than 1 project
A supplier can
supply more than 1
part to a project
DBMS PPT
DBMS PPT

More Related Content

What's hot

What's hot (20)

Er diagram
Er diagramEr diagram
Er diagram
 
Relational model
Relational modelRelational model
Relational model
 
Er model ppt
Er model pptEr model ppt
Er model ppt
 
Data modeling using the entity relationship model
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship model
 
Degree of relationship set
Degree of relationship setDegree of relationship set
Degree of relationship set
 
ER MODEL
ER MODELER MODEL
ER MODEL
 
Lecture 01 introduction to database
Lecture 01 introduction to databaseLecture 01 introduction to database
Lecture 01 introduction to database
 
Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modeling
 
Entity (types, attibute types)
Entity (types, attibute types)Entity (types, attibute types)
Entity (types, attibute types)
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
EER modeling
EER modelingEER modeling
EER modeling
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
DATABASE CONSTRAINTS
DATABASE CONSTRAINTSDATABASE CONSTRAINTS
DATABASE CONSTRAINTS
 
11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS
 
Data Models
Data ModelsData Models
Data Models
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbms
 
Uml class-diagram
Uml class-diagramUml class-diagram
Uml class-diagram
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 

Viewers also liked

Time manipulation lecture 2
Time manipulation lecture 2Time manipulation lecture 2
Time manipulation lecture 2Mudasir Syed
 
Pigeonhole Principle,Cardinality,Countability
Pigeonhole Principle,Cardinality,CountabilityPigeonhole Principle,Cardinality,Countability
Pigeonhole Principle,Cardinality,CountabilityKiran Munir
 
PHP mysql Er diagram
PHP mysql  Er diagramPHP mysql  Er diagram
PHP mysql Er diagramMudasir Syed
 
Chap2 practice key
Chap2 practice keyChap2 practice key
Chap2 practice keyIIUM
 
DBMS topics for BCA
DBMS topics for BCADBMS topics for BCA
DBMS topics for BCAAdbay
 
Cardinality and participation constraints
Cardinality and participation constraintsCardinality and participation constraints
Cardinality and participation constraintsNikhil Deswal
 
Entity Relationship Diagram presentation
Entity Relationship Diagram presentationEntity Relationship Diagram presentation
Entity Relationship Diagram presentationSopov Chan
 
Er diagram practical examples
Er diagram practical examplesEr diagram practical examples
Er diagram practical examplesRahul Khanwani
 
Example of dfd with answer
Example of dfd with answerExample of dfd with answer
Example of dfd with answerMahmoud Bakeer
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)tameemyousaf
 

Viewers also liked (13)

Time manipulation lecture 2
Time manipulation lecture 2Time manipulation lecture 2
Time manipulation lecture 2
 
Pigeonhole Principle,Cardinality,Countability
Pigeonhole Principle,Cardinality,CountabilityPigeonhole Principle,Cardinality,Countability
Pigeonhole Principle,Cardinality,Countability
 
PHP mysql Er diagram
PHP mysql  Er diagramPHP mysql  Er diagram
PHP mysql Er diagram
 
Chap2 practice key
Chap2 practice keyChap2 practice key
Chap2 practice key
 
DBMS topics for BCA
DBMS topics for BCADBMS topics for BCA
DBMS topics for BCA
 
Cardinality and participation constraints
Cardinality and participation constraintsCardinality and participation constraints
Cardinality and participation constraints
 
Data model and entity relationship
Data model and entity relationshipData model and entity relationship
Data model and entity relationship
 
ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
 
Entity Relationship Diagram presentation
Entity Relationship Diagram presentationEntity Relationship Diagram presentation
Entity Relationship Diagram presentation
 
Er diagram practical examples
Er diagram practical examplesEr diagram practical examples
Er diagram practical examples
 
Erd practice exercises
Erd practice exercisesErd practice exercises
Erd practice exercises
 
Example of dfd with answer
Example of dfd with answerExample of dfd with answer
Example of dfd with answer
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
 

Similar to DBMS PPT

ERD with complete knowledge
ERD with complete knowledgeERD with complete knowledge
ERD with complete knowledgeAsma Rasool
 
Jobs manager vs supervisor.pptx
Jobs manager vs supervisor.pptxJobs manager vs supervisor.pptx
Jobs manager vs supervisor.pptxprosofts1
 
03 Ch3 Notes Revised
03 Ch3 Notes Revised03 Ch3 Notes Revised
03 Ch3 Notes Revisedguest6f408c
 
Pokok bahasan #3a er modeling
Pokok bahasan #3a er modelingPokok bahasan #3a er modeling
Pokok bahasan #3a er modelingSlamet Widodo
 
Cn presentation on the topic called as re modelling
Cn presentation on the topic called as re modellingCn presentation on the topic called as re modelling
Cn presentation on the topic called as re modellingg30162363
 
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...Mustafa Kamel Mohammadi
 
The Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxThe Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxMANASINANDKISHORDEOR
 
DBMS Unit-2_Final.pptx
DBMS Unit-2_Final.pptxDBMS Unit-2_Final.pptx
DBMS Unit-2_Final.pptxparimala123
 
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
 
ECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptxECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptxmiftah88
 
Entityrelationshipmodel
EntityrelationshipmodelEntityrelationshipmodel
EntityrelationshipmodelEnes Bolfidan
 
3. Chapter Three.pdf
3. Chapter Three.pdf3. Chapter Three.pdf
3. Chapter Three.pdffikadumola
 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptxsandeep54552
 

Similar to DBMS PPT (20)

ERD with complete knowledge
ERD with complete knowledgeERD with complete knowledge
ERD with complete knowledge
 
Jobs manager vs supervisor.pptx
Jobs manager vs supervisor.pptxJobs manager vs supervisor.pptx
Jobs manager vs supervisor.pptx
 
Chapter3
Chapter3Chapter3
Chapter3
 
Chapter3
Chapter3Chapter3
Chapter3
 
03 Ch3 Notes Revised
03 Ch3 Notes Revised03 Ch3 Notes Revised
03 Ch3 Notes Revised
 
Pokok bahasan #3a er modeling
Pokok bahasan #3a er modelingPokok bahasan #3a er modeling
Pokok bahasan #3a er modeling
 
Cn presentation on the topic called as re modelling
Cn presentation on the topic called as re modellingCn presentation on the topic called as re modelling
Cn presentation on the topic called as re modelling
 
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...
 
The Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxThe Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptx
 
02er
02er02er
02er
 
DBMS Unit-2_Final.pptx
DBMS Unit-2_Final.pptxDBMS Unit-2_Final.pptx
DBMS Unit-2_Final.pptx
 
Conceptual Data Modeling
Conceptual Data ModelingConceptual Data Modeling
Conceptual Data Modeling
 
E r model
E r modelE r model
E r model
 
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
 
27 fcs157al3
27 fcs157al327 fcs157al3
27 fcs157al3
 
ECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptxECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptx
 
Entityrelationshipmodel
EntityrelationshipmodelEntityrelationshipmodel
Entityrelationshipmodel
 
3. Chapter Three.pdf
3. Chapter Three.pdf3. Chapter Three.pdf
3. Chapter Three.pdf
 
Data Models.pptx
Data Models.pptxData Models.pptx
Data Models.pptx
 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptx
 

Recently uploaded

İTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopİTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopEmre Günaydın
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfKamal Acharya
 
A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfKamal Acharya
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Krakówbim.edu.pl
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdfKamal Acharya
 
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdfONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdfKamal Acharya
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-IVigneshvaranMech
 
AI for workflow automation Use cases applications benefits and development.pdf
AI for workflow automation Use cases applications benefits and development.pdfAI for workflow automation Use cases applications benefits and development.pdf
AI for workflow automation Use cases applications benefits and development.pdfmahaffeycheryld
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdfKamal Acharya
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageRCC Institute of Information Technology
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
 
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and VisualizationKIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and VisualizationDr. Radhey Shyam
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdfAhmedHussein950959
 
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical EngineeringC Sai Kiran
 
shape functions of 1D and 2 D rectangular elements.pptx
shape functions of 1D and 2 D rectangular elements.pptxshape functions of 1D and 2 D rectangular elements.pptx
shape functions of 1D and 2 D rectangular elements.pptxVishalDeshpande27
 
Fruit shop management system project report.pdf
Fruit shop management system project report.pdfFruit shop management system project report.pdf
Fruit shop management system project report.pdfKamal Acharya
 
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...Amil baba
 
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptxCloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptxMd. Shahidul Islam Prodhan
 
Furniture showroom management system project.pdf
Furniture showroom management system project.pdfFurniture showroom management system project.pdf
Furniture showroom management system project.pdfKamal Acharya
 
retail automation billing system ppt.pptx
retail automation billing system ppt.pptxretail automation billing system ppt.pptx
retail automation billing system ppt.pptxfaamieahmd
 

Recently uploaded (20)

İTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopİTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering Workshop
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
 
A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdf
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Kraków
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdf
 
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdfONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
AI for workflow automation Use cases applications benefits and development.pdf
AI for workflow automation Use cases applications benefits and development.pdfAI for workflow automation Use cases applications benefits and development.pdf
AI for workflow automation Use cases applications benefits and development.pdf
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltage
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and VisualizationKIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
 
shape functions of 1D and 2 D rectangular elements.pptx
shape functions of 1D and 2 D rectangular elements.pptxshape functions of 1D and 2 D rectangular elements.pptx
shape functions of 1D and 2 D rectangular elements.pptx
 
Fruit shop management system project report.pdf
Fruit shop management system project report.pdfFruit shop management system project report.pdf
Fruit shop management system project report.pdf
 
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
 
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptxCloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
 
Furniture showroom management system project.pdf
Furniture showroom management system project.pdfFurniture showroom management system project.pdf
Furniture showroom management system project.pdf
 
retail automation billing system ppt.pptx
retail automation billing system ppt.pptxretail automation billing system ppt.pptx
retail automation billing system ppt.pptx
 

DBMS PPT

  • 2. 2 Chapter Outline • Example Database Application (COMPANY) • ER Model Concepts – Entities and Attributes – Entity Types, Value Sets, and Key Attributes – Relationships and Relationship Types – Weak Entity Types – Roles and Attributes in Relationship Types • ER Diagrams - Notation • ER Diagram for COMPANY Schema
  • 3. 3 Example COMPANY Database • Requirements of the Company – The company is organized into DEPARTMENTs. Each department has a name, number and an employee who manages the department. We keep track of the start date of the department manager. – Each department controls a number of PROJECTs. Each project has a name, number and is located at a single location.
  • 4. Example COMPANY Database (Cont.) –We store each EMPLOYEE’s social security number, address, salary, sex, and birthdate. Each employee works for one department but may work on several projects. We keep track of the number of hours per week that an employee currently works on each project. We also keep track of the direct supervisor of each employee. –Each employee may have a number of DEPENDENTs. For each dependent, we keep track of their name, sex, birthdate, and relationship to employee.
  • 5. EntityEntity • Entity - Thing which has existence distinguishable from otherEntity - Thing which has existence distinguishable from other objects (things)objects (things)  independent existence described by its attributes (set of properties)  determined by particular value of its attributes  can be concrete or abstract Example Rama, Raghu Maker Towers, Hotel Cecil
  • 6. ER Model Concepts • Entity – Entities are specific objects or things in the mini-world that are represented in the database. – For example the EMPLOYEE John Smith, the Research DEPARTMENT, the ProductX PROJECT • Entity type – Entities with the same basic attributes are grouped or typed into an entity type. – For example, the EMPLOYEE entity type or the PROJECT entity type.
  • 7. ER Model Concepts • Attributes – Attributes are properties used to describe an entity. – For example an EMPLOYEE entity may have a Name, SSN, Address, Sex, BirthDate – A specific entity will have a value for each of its attributes. For example a specific employee entity may have Name='John Smith', SSN='123456789', Address ='731, Fondren, Houston, TX', Sex='M', BirthDate='09-JAN-55‘ – Each attribute has a value set (or data type) associated with it – e.g. integer, string, subrange, enumerated type, …
  • 8.
  • 9. Key Attributes • An attribute of an entity type for which each entity must have a unique value is called a key attribute of the entity type. For example, SSN of EMPLOYEE. • A key attribute may be composite. For example, VehicleTagNumber is a key of the CAR entity type with components (Number, State). • An entity type may have more than one key. For example, the CAR entity type may have two keys: – VehicleIdentificationNumber (popularly called VIN) and – VehicleTagNumber (Number, State), also known as license_plate number.
  • 10.
  • 11. Entity Sets • An entity set is a set of entities of the same type that share the same properties. – Example: set of all persons, companies, trees, holidays ENTITY SET corresponding to the ENTITY TYPE CAR car1 ((ABC 123, TEXAS), TK629, Ford Mustang, convertible, 1999, (red, black)) car2 ((ABC 123, NEW YORK), WP9872, Nissan 300ZX, 2-door, 2002, (blue)) car3 ((VSY 720, TEXAS), TD729, Buick LeSabre, 4-door, 2003, (white, blue)) . CAR Registration(RegistrationNumber, State), VehicleID, Make, Model, Year, (Color)
  • 12. SUMMARY OF ER-DIAGRAM NOTATION FOR ER SCHEMAS Meaning ENTITY TYPE WEAK ENTITY TYPE RELATIONSHIP TYPE IDENTIFYING RELATIONSHIP TYPE ATTRIBUTE KEY ATTRIBUTE MULTIVALUED ATTRIBUTE COMPOSITE ATTRIBUTE DERIVED ATTRIBUTE TOTAL PARTICIPATION OF E2 IN R CARDINALITY RATIO 1:N FOR E1:E2 IN R Symbol E1 R E2 E1 R E2 NN11
  • 13. Summary of Symbols Used in E-R Notation
  • 14. ER DIAGRAM – Entity Types are: EMPLOYEE, DEPARTMENT, PROJECT, DEPENDENT
  • 15. Relationship • A relationship relates two or more distinct entities with a specific meaning. • For example, EMPLOYEE John Smith works on the ProductX PROJECT or EMPLOYEE Franklin Wong manages the Research DEPARTMENT.
  • 16. Relationship Type • Relationships of the same type are grouped or typed into a relationship type. • For example, the WORKS_ON relationship type in which EMPLOYEEs and PROJECTs participate, or the MANAGES relationship type in which EMPLOYEEs and DEPARTMENTs participate. • More than one relationship type can exist with the same participating entity types. • For example, MANAGES and WORKS_FOR are distinct relationships between EMPLOYEE and DEPARTMENT, but with different meanings and different relationship instances. • AA relationship setrelationship set is a class of relationships of the same type,is a class of relationships of the same type, having common propertieshaving common properties
  • 17.
  • 18. Attributes of Relationship types • A relationship type can have attributes; for example, HoursPerWeek of WORKS_ON; its value for each relationship instance describes the number of hours per week that an EMPLOYEE works on a PROJECT.
  • 19. Attribute of a Relationship Type is: Hours of WORKS_ON
  • 20.
  • 21. Structural Constraints – one way to express semantics of relationships Cardinality ratio (of a binary relationship): 1:1, 1:N, N:1, or M:N SHOWN BY PLACING APPROPRIATE NUMBER ON THE LINK. Participation constraint (on each participating entity type): total (called existence dependency) or partial. SHOWN BY DOUBLE LINING THE LINK NOTE: These are easy to specify for Binary Relationship Types.
  • 22. The minimum and maximum values of this connectivity is called the cardinality of the relationship
  • 23.
  • 24.
  • 25.
  • 26.
  • 27. Participation of an Entity Set in a Relationship Set Total participation (indicated by double line): every entity in the entity set participates in at least one relationship in the relationship set E.g. participation of loan in borrower is total every loan must have a customer associated to it via borrower Partial participation: some entities may not participate in any relationship in the relationship set E.g. participation of customer in borrower is partial
  • 28.
  • 29. ER DIAGRAM – Relationship Types are: WORKS_FOR, MANAGES, WORKS_ON, CONTROLS, SUPERVISION, DEPENDENTS_OF
  • 30. Roles • Entity sets of a relationship need not be distinct • The labels “manager” and “worker” are called roles; they specify how employee entities interact via the works-for relationship set. • Roles are indicated in E-R diagrams by labeling the lines that connect diamonds to rectangles. • Role labels are optional, and are used to clarify semantics of the relationship
  • 31. Recursive Relationship Type • Both participants are same entity type in different roles. • For example, SUPERVISION relationships between EMPLOYEE (in role of supervisor or boss) and (another) EMPLOYEE (in role of subordinate or worker). • In following figure, first role participation labeled with 1 and second role participation labeled with 2. • In ER diagram, need to display role names to distinguish participations.
  • 33. Recursive Relationship Type is: SUPERVISION (participation role names are shown)
  • 34. Entities that are distinguished by their relationship to another entityEntities that are distinguished by their relationship to another entity  Weak entity hasWeak entity has partial key or discriminatorpartial key or discriminator ––  Identify entities related to the same strong entity.Identify entities related to the same strong entity. Weak EntityWeak Entity  The primary key = primary key of the strong entity setThe primary key = primary key of the strong entity set + discriminator.+ discriminator.  Do not have a key of their own PF account of an employee Engineer of a ship
  • 35. Weak Entity Types • A weak entity must participate in an identifying relationship type with an owner or identifying entity type • Entities are identified by the combination of: – A partial key of the weak entity type – The particular entity they are related to in the identifying entity type Example: Suppose that a DEPENDENT entity is identified by the dependent’s first name and birthdate, and the specific EMPLOYEE that the dependent is related to. DEPENDENT is a weak entity type with EMPLOYEE as its identifying entity type via the identifying relationship type DEPENDENT_OF
  • 36. Weak Entity Types Example: Suppose that a DEPENDENT entity is identified by the dependent’s first name and birthdate, and the specific EMPLOYEE that the dependent is related to. DEPENDENT is a weak entity type with EMPLOYEE as its identifying entity type via the identifying relationship type DEPENDENT_OF
  • 37. Weak Entity Type is: DEPENDENT Identifying Relationship is: DEPENDENTS_OF
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52. These attributes best describe the relationship prescription rather than any individual entity Doctor, Patient or Medicine.
  • 53. The identifying relationship is the one which relates the weak entity (dependant) with the strong entity (Employee) on which it depends. Id is underlined with a dotted line because it is used to form composite key of dependent entity along with E#.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61. Relationships of Higher Degree Relationship types of degree 2 are called binary Relationship types of degree 3 are called ternary and of degree n are called n-ary In general, an n-ary relationship is not equivalent to n binary relationships
  • 62. Example of a ternary relationship SUPPLY relationship instance: (s,j,p) A supplier s supplies part p to project j
  • 63. Ternary vs Binary Relationship Types Suppose (s,j), (j,p), and (s,p) participate in the relationships SUPPLIES, USES, and CAN_SUPPLY, respectively Is this equivalent to the instance (s,j,p) in ternary relationship? 3 binary relationships
  • 64. Example of a ternary relationship Supplier Project Part Ace R1 T1 Ace R2 T2 Acme R1 T2 Acme R2 T1 Lowes R1 T1 Lowes R2 T2 Supplier Project Ace R1 Ace R2 Acme R1 Acme R2 Lowes R1 Lowes R2 Project Part R1 T1 R1 T2 R2 T1 R2 T2 Supplier Part Ace T1 Ace T2 Acme T2 Acme T1 Lowes T1 Lowes T2
  • 65. Ternary Relationships TAUGHT_DURING and OFFERED_DURING are redundant, but CAN_TEACH is not redundant 3 binary relationships may represent different info than a single ternary relationship
  • 66. Cardinality Ratio of Ternary Relationships 1 M N There is 1 supplier for every (project, part) combination A supplier can supply same part to more than 1 project A supplier can supply more than 1 part to a project