SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
CHAPTER 3

Degree of relationship
Degree of relationship refers to the number
of participating entities in a relationship.

Dr.Girija Narasimhan

1
Unary Relationship

Subjects may be prerequisites for
other subjects.

Dr.Girija Narasimhan

2
M:N unary relationship: A Subject may have
many other Subjects as prerequisites and each
Subject may be a prerequisite to many other
Subjects

1:M unary relationship:
An Employee may manage many Employees,
but an Employee is managed by only one
Employee

1:1 unary relationship:
A Person may be married to only one Person.

Dr.Girija Narasimhan

3
Binary Relationship
If there are two entities involved in relationship then it is
referred to as binary relationship.

Dr.Girija Narasimhan

4
Ternary Relationship

If there are three entities involved then it is called as ternary relationship and so on.

The University might need to record which
teachers taught which subjects in which
courses.
Dr.Girija Narasimhan

5
The cardinality of a relationship is the number of instances of entity B that can be
associated with entity A. There is a minimum cardinality and a maximum cardinality for
each relationship, with an unspecified maximum cardinality being shown as
N. Cardinality limits are usually derived from the organizations policies or external
constraints.

At the University, each Teacher can teach an
unspecified maximum number of subjects as
long as his/her weekly hours do not exceed 24
(this is an external constraint set by an
industrial award). Teachers may teach 0
subjects if they are involved in non teaching
projects. Therefore, the cardinality limits for
TEACHER are (O,N).

Dr.Girija Narasimhan

The University's policies state that each
Subject is taught by only one teacher,
but it is possible to have Subjects that
have not yet been assigned a
teacher. Therefore, the cardinality limits
for SUBJECT are (0,1).

6
Relation

Relation schema

Employee Table

Relation (R )
Attributes
(A1,A2…An)

Employee (Emp_id,ename,Salary)
Foreign key

Primary key or identifier

Employee (Emp_id,ename,Salary)

Employee (Emp_id,ename,Salary,dept_name)
Foreign key

Composite key

Department(dept_name,ename,Salary)

Over_time (emp_id, dept_name,No_of_hour)

Composite key
Dr.Girija Narasimhan

7
INTEGRITY CONSTRAINTS
DOMAIN
CONSTRAINTS

ENTITY Integrity
CONSTRAINTS

Dr.Girija Narasimhan

Referential
Integrity
CONSTRAINTS

8
DOMAIN CONSTRAINTS

Domain_name

Meaning

Data type

Age

Years of the person

Phone_no

Conduct number

Mark

size

number

3

number

Scored by Student
in Exam

number

Dr.Girija Narasimhan

8

3

Allowable value or range
<=110
Must be 8 digit and
<99999999 and
>90000000

>=0 and <=100

9
ENTITY Integrity CONSTRAINTS
Every relation must have primary key
Every primary key attribute is non- null and unique

Unique means, value of the primary key must
be different not be same.
Null is a value, suppose no other value not assign or apply.
Null is not zero (0) or blank (“ “)

Dr.Girija Narasimhan

10
ENTITY Integrity CONSTRAINTS
Not Unique
Department

Entity integrity not enforced

Not Unique

Same value

Dr.Girija Narasimhan

11
ENTITY Integrity CONSTRAINTS

Null is a value, suppose no other value not assign or apply.

Null is not zero (0) or blank (“ “)
Not Null

Entity integrity not enforced

No null value allowed in the primary key

Dr.Girija Narasimhan

12
Referential Integrity
CONSTRAINTS
• Two tables have relationship or association then use foreign key
Why Referential Integrity constraints?
To maintain Consistency among rows of two relationship.

Rule:
Rule 1: Foreign key must match with primary key of the other
relation.
Rule 2: Otherwise, If it is not matching then Foreign key value must
be “NULL”

Dr.Girija Narasimhan

13
Referential Integrity CONSTRAINTS
EMPLOYEE
Foreign key
Department

EMPLOYEE
Repetition in the foreign
key - allowed

Null value allowed
in the foreign key
Dr.Girija Narasimhan

14
EMPLOYEE

Referential Integrity CONSTRAINTS
Department

Not matching any dept_name in
department table.
So Referential integrity not
enforced

Dr.Girija Narasimhan

15
Referential Integrity CONSTRAINTS
Rule 1: Foreign key must match with primary key of the other relation.

CASCADING DELETE

PROHIBIT DELETE

Dr.Girija Narasimhan

16
Referential Integrity CONSTRAINTS

Dr.Girija Narasimhan

17
CASCADING DELETE
If delete the Primary key table record, automatically the foreign key referencing
table record information also deleted.
For example: Suppose if I delete deptno 20 in DEPT table (master /parent),
automatically in the EMP table empno 6666 and Empno 7329 also deleted
because both are referencing deptno 20.

Dr.Girija Narasimhan

18
PROHIBIT DELETE
Before deleting primary key record, first delete all the foreign key associated
records in referencing table or child table.
For example: First delete EMP table empno 6666 and Empno 7329 and
then delete DEPT table deptno 20

Dr.Girija Narasimhan

19
Rule 2: Otherwise, If it is not matching then Foreign key value must be “NULL”
Place a null value in the Foreign key.
When?
Suppose I want to remove deptno 20 from DEPT TABLE, but I want to retain
or keep the employee 6666 and 7329 in the EMP table , then in the
foreign key attribute DEPTNO column in EMP table instead of 20 I will put
“Null” in both the record 6666 and 7329.

Dr.Girija Narasimhan

20
Mapping ER diagrams to Relations

Why?
Transform Conceptual model to Relational model

Entity type
Regular

Week entity type
Create a new relation

Composite

Binary Relations

Unary Relation

1-1 relation type
1-N relation type
M-N relation type

Multivalued

Dr.Girija Narasimhan

21
Mapping ER diagrams to Relations
Entity type
Regular

Dr.Girija Narasimhan

22
Mapping ER diagrams to Relations
Entity type

Dr.Girija Narasimhan

Composite

23
Mapping ER diagrams to Relations
Entity type

Dr.Girija Narasimhan

Multi valued

24
Mapping Weak Entities

weak entity type does not have an independent existence, but exists only through an
identifying relationship with another entity type called the owner or strong entity.

Dr.Girija Narasimhan

25
Mapping 1-1 Binary Relationship Type
Employee must assign
by only one
Employee may manage one or may
department.
not manage any department

One and only One (Mandatory One)

Zero or One (Optional One)

Using foreign key

Dr.Girija Narasimhan

26
Mapping 1-N Binary Relationship Type

Department have one
or more employee

One or More (Mandatory One)

Employee must work only
one department.

One and only One (Mandatory One)

Dr.Girija Narasimhan

27
Mapping M-N Binary Relationship Type

Employee join one
or more project

Project has one
more employee

One or More (Mandatory One)

One or More (Mandatory One)

Dr.Girija Narasimhan

28
Mapping Unary Relation Type
one employee appointed
as supervisor

Dr.Girija Narasimhan

29

Weitere ähnliche Inhalte

Was ist angesagt?

Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship DiagramShakila Mahjabin
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational modelChirag vasava
 
joins and subqueries in big data analysis
joins and subqueries in big data analysisjoins and subqueries in big data analysis
joins and subqueries in big data analysisSanSan149
 
ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...Raj vardhan
 
Relational algebra (basics)
Relational algebra (basics)Relational algebra (basics)
Relational algebra (basics)usama nizam
 
6. Integrity and Security in DBMS
6. Integrity and Security in DBMS6. Integrity and Security in DBMS
6. Integrity and Security in DBMSkoolkampus
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationBIT Durg
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mappingShubham Saini
 
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database ModelShishir Aryal
 
Mapping ER and EER Model
Mapping ER and EER ModelMapping ER and EER Model
Mapping ER and EER ModelMary Brinda
 
Database architecture
Database architectureDatabase architecture
Database architectureVENNILAV6
 
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 modelJafar Nesargi
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity ConstraintsMegha yadav
 

Was ist angesagt? (20)

Unit03 dbms
Unit03 dbmsUnit03 dbms
Unit03 dbms
 
enhanced er diagram
enhanced er diagramenhanced er diagram
enhanced er diagram
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
joins and subqueries in big data analysis
joins and subqueries in big data analysisjoins and subqueries in big data analysis
joins and subqueries in big data analysis
 
ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Relational algebra (basics)
Relational algebra (basics)Relational algebra (basics)
Relational algebra (basics)
 
ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
 
6. Integrity and Security in DBMS
6. Integrity and Security in DBMS6. Integrity and Security in DBMS
6. Integrity and Security in DBMS
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mapping
 
Chapter02
Chapter02Chapter02
Chapter02
 
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database Model
 
Mapping ER and EER Model
Mapping ER and EER ModelMapping ER and EER Model
Mapping ER and EER Model
 
DBMS PPT
DBMS PPTDBMS PPT
DBMS PPT
 
Database architecture
Database architectureDatabase architecture
Database architecture
 
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
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 

Andere mochten auch

Relational keys
Relational keysRelational keys
Relational keysSana2020
 
Entity relationship
Entity relationshipEntity relationship
Entity relationshipronnjemmele
 
Agile needs resurgence of visual modeling
Agile needs resurgence of visual modelingAgile needs resurgence of visual modeling
Agile needs resurgence of visual modelingRussell Pannone
 
Diferencias y semejanzas inv. cualitativa y cuantitativa
Diferencias y semejanzas inv. cualitativa y cuantitativaDiferencias y semejanzas inv. cualitativa y cuantitativa
Diferencias y semejanzas inv. cualitativa y cuantitativagabyfreirefranco
 
Designing Teams for Emerging Challenges
Designing Teams for Emerging ChallengesDesigning Teams for Emerging Challenges
Designing Teams for Emerging ChallengesAaron Irizarry
 
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with DataSeth Familian
 

Andere mochten auch (8)

Relational keys
Relational keysRelational keys
Relational keys
 
Entity relationship
Entity relationshipEntity relationship
Entity relationship
 
Ch 3 E R Model
Ch 3  E R  ModelCh 3  E R  Model
Ch 3 E R Model
 
Agile needs resurgence of visual modeling
Agile needs resurgence of visual modelingAgile needs resurgence of visual modeling
Agile needs resurgence of visual modeling
 
Diferencias y semejanzas inv. cualitativa y cuantitativa
Diferencias y semejanzas inv. cualitativa y cuantitativaDiferencias y semejanzas inv. cualitativa y cuantitativa
Diferencias y semejanzas inv. cualitativa y cuantitativa
 
Designing Teams for Emerging Challenges
Designing Teams for Emerging ChallengesDesigning Teams for Emerging Challenges
Designing Teams for Emerging Challenges
 
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with Data
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
 

Ähnlich wie Database relationship

Special lecture er diagram
Special lecture er diagramSpecial lecture er diagram
Special lecture er diagramNiaz Ali
 
Desigining of Database - ER Model
Desigining of Database - ER ModelDesigining of Database - ER Model
Desigining of Database - ER ModelAjay Chhimpa
 
Entity relationship diagram (erd)
Entity relationship  diagram (erd)Entity relationship  diagram (erd)
Entity relationship diagram (erd)Shahariar Alam
 
Entity Relationship Diagram2
Entity Relationship Diagram2Entity Relationship Diagram2
Entity Relationship Diagram2sadeenedian08
 
Fundamentals of database system - Relational data model and relational datab...
Fundamentals of database system  - Relational data model and relational datab...Fundamentals of database system  - Relational data model and relational datab...
Fundamentals of database system - Relational data model and relational datab...Mustafa Kamel Mohammadi
 
ERD with complete knowledge
ERD with complete knowledgeERD with complete knowledge
ERD with complete knowledgeAsma Rasool
 
erdiagramspresentation-150826044953-lva1-app6891.pdf
erdiagramspresentation-150826044953-lva1-app6891.pdferdiagramspresentation-150826044953-lva1-app6891.pdf
erdiagramspresentation-150826044953-lva1-app6891.pdfvinayakjadhav94
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship DiagramRakhi Mukherji
 
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
 
chap03Corrected.ppt
chap03Corrected.pptchap03Corrected.ppt
chap03Corrected.pptMutiaSari53
 
FIXED INCOMEModule 3 Group Homework1. [6pts] Given a fiv
FIXED INCOMEModule 3 Group Homework1. [6pts] Given a fivFIXED INCOMEModule 3 Group Homework1. [6pts] Given a fiv
FIXED INCOMEModule 3 Group Homework1. [6pts] Given a fivShainaBoling829
 
DBMS Unit-2_Final.pptx
DBMS Unit-2_Final.pptxDBMS Unit-2_Final.pptx
DBMS Unit-2_Final.pptxparimala123
 
Fundamentals of Database Management Systems 2nd Edition Gillenson Solutions M...
Fundamentals of Database Management Systems 2nd Edition Gillenson Solutions M...Fundamentals of Database Management Systems 2nd Edition Gillenson Solutions M...
Fundamentals of Database Management Systems 2nd Edition Gillenson Solutions M...gamuhuto
 

Ähnlich wie Database relationship (20)

Special lecture er diagram
Special lecture er diagramSpecial lecture er diagram
Special lecture er diagram
 
Desigining of Database - ER Model
Desigining of Database - ER ModelDesigining of Database - ER Model
Desigining of Database - ER Model
 
Entity relationship diagram (erd)
Entity relationship  diagram (erd)Entity relationship  diagram (erd)
Entity relationship diagram (erd)
 
Datamodels.pptx
Datamodels.pptxDatamodels.pptx
Datamodels.pptx
 
DBMS Part-2.pdf
DBMS Part-2.pdfDBMS Part-2.pdf
DBMS Part-2.pdf
 
ER model
ER modelER model
ER model
 
Entity Relationship Diagram2
Entity Relationship Diagram2Entity Relationship Diagram2
Entity Relationship Diagram2
 
Fundamentals of database system - Relational data model and relational datab...
Fundamentals of database system  - Relational data model and relational datab...Fundamentals of database system  - Relational data model and relational datab...
Fundamentals of database system - Relational data model and relational datab...
 
27 fcs157al3
27 fcs157al327 fcs157al3
27 fcs157al3
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
ERD with complete knowledge
ERD with complete knowledgeERD with complete knowledge
ERD with complete knowledge
 
erdiagramspresentation-150826044953-lva1-app6891.pdf
erdiagramspresentation-150826044953-lva1-app6891.pdferdiagramspresentation-150826044953-lva1-app6891.pdf
erdiagramspresentation-150826044953-lva1-app6891.pdf
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
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...
 
chap03Corrected.ppt
chap03Corrected.pptchap03Corrected.ppt
chap03Corrected.ppt
 
FIXED INCOMEModule 3 Group Homework1. [6pts] Given a fiv
FIXED INCOMEModule 3 Group Homework1. [6pts] Given a fivFIXED INCOMEModule 3 Group Homework1. [6pts] Given a fiv
FIXED INCOMEModule 3 Group Homework1. [6pts] Given a fiv
 
DBMS Unit-2_Final.pptx
DBMS Unit-2_Final.pptxDBMS Unit-2_Final.pptx
DBMS Unit-2_Final.pptx
 
Er diagrams presentation
Er diagrams presentationEr diagrams presentation
Er diagrams presentation
 
Er diagrams presentation
Er diagrams presentationEr diagrams presentation
Er diagrams presentation
 
Fundamentals of Database Management Systems 2nd Edition Gillenson Solutions M...
Fundamentals of Database Management Systems 2nd Edition Gillenson Solutions M...Fundamentals of Database Management Systems 2nd Edition Gillenson Solutions M...
Fundamentals of Database Management Systems 2nd Edition Gillenson Solutions M...
 

Mehr von Girija Muscut

Visualization using Tableau
Visualization using TableauVisualization using Tableau
Visualization using TableauGirija Muscut
 
Effective Visualization with Tableau
Effective Visualization with TableauEffective Visualization with Tableau
Effective Visualization with TableauGirija Muscut
 
Guruvayoor song with audio-Udayasthamana puja
Guruvayoor song with audio-Udayasthamana puja Guruvayoor song with audio-Udayasthamana puja
Guruvayoor song with audio-Udayasthamana puja Girija Muscut
 
Lakshmi lalli with audio
Lakshmi lalli with audioLakshmi lalli with audio
Lakshmi lalli with audioGirija Muscut
 
Bagyada laskhmi purandara dasa
Bagyada laskhmi purandara dasaBagyada laskhmi purandara dasa
Bagyada laskhmi purandara dasaGirija Muscut
 
Amba nee irangaayenil - papanasam sivan song
Amba nee irangaayenil - papanasam sivan songAmba nee irangaayenil - papanasam sivan song
Amba nee irangaayenil - papanasam sivan songGirija Muscut
 
Mahalakshmi jagan madha - papanasm sivan tamil song
Mahalakshmi jagan madha  - papanasm sivan tamil songMahalakshmi jagan madha  - papanasm sivan tamil song
Mahalakshmi jagan madha - papanasm sivan tamil songGirija Muscut
 
Sowbhagayaha laskhmi varuvai nee tamil song
Sowbhagayaha laskhmi varuvai nee tamil songSowbhagayaha laskhmi varuvai nee tamil song
Sowbhagayaha laskhmi varuvai nee tamil songGirija Muscut
 
Bega baro Bega baro Neela Megha Varna-Vadhiraja Theertha
Bega baro Bega baro Neela Megha Varna-Vadhiraja TheerthaBega baro Bega baro Neela Megha Varna-Vadhiraja Theertha
Bega baro Bega baro Neela Megha Varna-Vadhiraja TheerthaGirija Muscut
 
Saraswathi bhajan 1 with tamil meaning
Saraswathi bhajan 1 with tamil meaningSaraswathi bhajan 1 with tamil meaning
Saraswathi bhajan 1 with tamil meaningGirija Muscut
 
Aneyu karadare -Purandara Dasar.
Aneyu karadare -Purandara Dasar.Aneyu karadare -Purandara Dasar.
Aneyu karadare -Purandara Dasar.Girija Muscut
 
Maithriam Bhajatha with tamil meaning (lyrics)
Maithriam Bhajatha with tamil meaning (lyrics)Maithriam Bhajatha with tamil meaning (lyrics)
Maithriam Bhajatha with tamil meaning (lyrics)Girija Muscut
 
Unit 4 scd2-exercise 1-solution
Unit 4 scd2-exercise 1-solutionUnit 4 scd2-exercise 1-solution
Unit 4 scd2-exercise 1-solutionGirija Muscut
 
Unit 2 - Slowly Changing Dimension Type 1 (SCD1) (insert)
Unit 2  - Slowly Changing Dimension Type 1 (SCD1) (insert)Unit 2  - Slowly Changing Dimension Type 1 (SCD1) (insert)
Unit 2 - Slowly Changing Dimension Type 1 (SCD1) (insert)Girija Muscut
 
Slowly Changing Dimension Type 1 (SCD 1) exercise 2 solution insert and update
Slowly Changing Dimension Type 1 (SCD 1) exercise 2 solution insert and updateSlowly Changing Dimension Type 1 (SCD 1) exercise 2 solution insert and update
Slowly Changing Dimension Type 1 (SCD 1) exercise 2 solution insert and updateGirija Muscut
 

Mehr von Girija Muscut (20)

Tamil Nalvar
Tamil Nalvar Tamil Nalvar
Tamil Nalvar
 
Visualization using Tableau
Visualization using TableauVisualization using Tableau
Visualization using Tableau
 
Introduction to ml
Introduction to mlIntroduction to ml
Introduction to ml
 
Effective Visualization with Tableau
Effective Visualization with TableauEffective Visualization with Tableau
Effective Visualization with Tableau
 
Guruvayoor song with audio-Udayasthamana puja
Guruvayoor song with audio-Udayasthamana puja Guruvayoor song with audio-Udayasthamana puja
Guruvayoor song with audio-Udayasthamana puja
 
Lakshmi lalli with audio
Lakshmi lalli with audioLakshmi lalli with audio
Lakshmi lalli with audio
 
Bagyada laskhmi purandara dasa
Bagyada laskhmi purandara dasaBagyada laskhmi purandara dasa
Bagyada laskhmi purandara dasa
 
Lakshmi lalli
Lakshmi lalliLakshmi lalli
Lakshmi lalli
 
Amba nee irangaayenil - papanasam sivan song
Amba nee irangaayenil - papanasam sivan songAmba nee irangaayenil - papanasam sivan song
Amba nee irangaayenil - papanasam sivan song
 
Mahalakshmi jagan madha - papanasm sivan tamil song
Mahalakshmi jagan madha  - papanasm sivan tamil songMahalakshmi jagan madha  - papanasm sivan tamil song
Mahalakshmi jagan madha - papanasm sivan tamil song
 
Sowbhagayaha laskhmi varuvai nee tamil song
Sowbhagayaha laskhmi varuvai nee tamil songSowbhagayaha laskhmi varuvai nee tamil song
Sowbhagayaha laskhmi varuvai nee tamil song
 
Bega baro Bega baro Neela Megha Varna-Vadhiraja Theertha
Bega baro Bega baro Neela Megha Varna-Vadhiraja TheerthaBega baro Bega baro Neela Megha Varna-Vadhiraja Theertha
Bega baro Bega baro Neela Megha Varna-Vadhiraja Theertha
 
Rama Nama Bhajan
Rama Nama BhajanRama Nama Bhajan
Rama Nama Bhajan
 
Saratha devi song 1
Saratha devi song 1Saratha devi song 1
Saratha devi song 1
 
Saraswathi bhajan 1 with tamil meaning
Saraswathi bhajan 1 with tamil meaningSaraswathi bhajan 1 with tamil meaning
Saraswathi bhajan 1 with tamil meaning
 
Aneyu karadare -Purandara Dasar.
Aneyu karadare -Purandara Dasar.Aneyu karadare -Purandara Dasar.
Aneyu karadare -Purandara Dasar.
 
Maithriam Bhajatha with tamil meaning (lyrics)
Maithriam Bhajatha with tamil meaning (lyrics)Maithriam Bhajatha with tamil meaning (lyrics)
Maithriam Bhajatha with tamil meaning (lyrics)
 
Unit 4 scd2-exercise 1-solution
Unit 4 scd2-exercise 1-solutionUnit 4 scd2-exercise 1-solution
Unit 4 scd2-exercise 1-solution
 
Unit 2 - Slowly Changing Dimension Type 1 (SCD1) (insert)
Unit 2  - Slowly Changing Dimension Type 1 (SCD1) (insert)Unit 2  - Slowly Changing Dimension Type 1 (SCD1) (insert)
Unit 2 - Slowly Changing Dimension Type 1 (SCD1) (insert)
 
Slowly Changing Dimension Type 1 (SCD 1) exercise 2 solution insert and update
Slowly Changing Dimension Type 1 (SCD 1) exercise 2 solution insert and updateSlowly Changing Dimension Type 1 (SCD 1) exercise 2 solution insert and update
Slowly Changing Dimension Type 1 (SCD 1) exercise 2 solution insert and update
 

Kürzlich hochgeladen

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 

Kürzlich hochgeladen (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

Database relationship

  • 1. CHAPTER 3 Degree of relationship Degree of relationship refers to the number of participating entities in a relationship. Dr.Girija Narasimhan 1
  • 2. Unary Relationship Subjects may be prerequisites for other subjects. Dr.Girija Narasimhan 2
  • 3. M:N unary relationship: A Subject may have many other Subjects as prerequisites and each Subject may be a prerequisite to many other Subjects 1:M unary relationship: An Employee may manage many Employees, but an Employee is managed by only one Employee 1:1 unary relationship: A Person may be married to only one Person. Dr.Girija Narasimhan 3
  • 4. Binary Relationship If there are two entities involved in relationship then it is referred to as binary relationship. Dr.Girija Narasimhan 4
  • 5. Ternary Relationship If there are three entities involved then it is called as ternary relationship and so on. The University might need to record which teachers taught which subjects in which courses. Dr.Girija Narasimhan 5
  • 6. The cardinality of a relationship is the number of instances of entity B that can be associated with entity A. There is a minimum cardinality and a maximum cardinality for each relationship, with an unspecified maximum cardinality being shown as N. Cardinality limits are usually derived from the organizations policies or external constraints. At the University, each Teacher can teach an unspecified maximum number of subjects as long as his/her weekly hours do not exceed 24 (this is an external constraint set by an industrial award). Teachers may teach 0 subjects if they are involved in non teaching projects. Therefore, the cardinality limits for TEACHER are (O,N). Dr.Girija Narasimhan The University's policies state that each Subject is taught by only one teacher, but it is possible to have Subjects that have not yet been assigned a teacher. Therefore, the cardinality limits for SUBJECT are (0,1). 6
  • 7. Relation Relation schema Employee Table Relation (R ) Attributes (A1,A2…An) Employee (Emp_id,ename,Salary) Foreign key Primary key or identifier Employee (Emp_id,ename,Salary) Employee (Emp_id,ename,Salary,dept_name) Foreign key Composite key Department(dept_name,ename,Salary) Over_time (emp_id, dept_name,No_of_hour) Composite key Dr.Girija Narasimhan 7
  • 9. DOMAIN CONSTRAINTS Domain_name Meaning Data type Age Years of the person Phone_no Conduct number Mark size number 3 number Scored by Student in Exam number Dr.Girija Narasimhan 8 3 Allowable value or range <=110 Must be 8 digit and <99999999 and >90000000 >=0 and <=100 9
  • 10. ENTITY Integrity CONSTRAINTS Every relation must have primary key Every primary key attribute is non- null and unique Unique means, value of the primary key must be different not be same. Null is a value, suppose no other value not assign or apply. Null is not zero (0) or blank (“ “) Dr.Girija Narasimhan 10
  • 11. ENTITY Integrity CONSTRAINTS Not Unique Department Entity integrity not enforced Not Unique Same value Dr.Girija Narasimhan 11
  • 12. ENTITY Integrity CONSTRAINTS Null is a value, suppose no other value not assign or apply. Null is not zero (0) or blank (“ “) Not Null Entity integrity not enforced No null value allowed in the primary key Dr.Girija Narasimhan 12
  • 13. Referential Integrity CONSTRAINTS • Two tables have relationship or association then use foreign key Why Referential Integrity constraints? To maintain Consistency among rows of two relationship. Rule: Rule 1: Foreign key must match with primary key of the other relation. Rule 2: Otherwise, If it is not matching then Foreign key value must be “NULL” Dr.Girija Narasimhan 13
  • 14. Referential Integrity CONSTRAINTS EMPLOYEE Foreign key Department EMPLOYEE Repetition in the foreign key - allowed Null value allowed in the foreign key Dr.Girija Narasimhan 14
  • 15. EMPLOYEE Referential Integrity CONSTRAINTS Department Not matching any dept_name in department table. So Referential integrity not enforced Dr.Girija Narasimhan 15
  • 16. Referential Integrity CONSTRAINTS Rule 1: Foreign key must match with primary key of the other relation. CASCADING DELETE PROHIBIT DELETE Dr.Girija Narasimhan 16
  • 18. CASCADING DELETE If delete the Primary key table record, automatically the foreign key referencing table record information also deleted. For example: Suppose if I delete deptno 20 in DEPT table (master /parent), automatically in the EMP table empno 6666 and Empno 7329 also deleted because both are referencing deptno 20. Dr.Girija Narasimhan 18
  • 19. PROHIBIT DELETE Before deleting primary key record, first delete all the foreign key associated records in referencing table or child table. For example: First delete EMP table empno 6666 and Empno 7329 and then delete DEPT table deptno 20 Dr.Girija Narasimhan 19
  • 20. Rule 2: Otherwise, If it is not matching then Foreign key value must be “NULL” Place a null value in the Foreign key. When? Suppose I want to remove deptno 20 from DEPT TABLE, but I want to retain or keep the employee 6666 and 7329 in the EMP table , then in the foreign key attribute DEPTNO column in EMP table instead of 20 I will put “Null” in both the record 6666 and 7329. Dr.Girija Narasimhan 20
  • 21. Mapping ER diagrams to Relations Why? Transform Conceptual model to Relational model Entity type Regular Week entity type Create a new relation Composite Binary Relations Unary Relation 1-1 relation type 1-N relation type M-N relation type Multivalued Dr.Girija Narasimhan 21
  • 22. Mapping ER diagrams to Relations Entity type Regular Dr.Girija Narasimhan 22
  • 23. Mapping ER diagrams to Relations Entity type Dr.Girija Narasimhan Composite 23
  • 24. Mapping ER diagrams to Relations Entity type Dr.Girija Narasimhan Multi valued 24
  • 25. Mapping Weak Entities weak entity type does not have an independent existence, but exists only through an identifying relationship with another entity type called the owner or strong entity. Dr.Girija Narasimhan 25
  • 26. Mapping 1-1 Binary Relationship Type Employee must assign by only one Employee may manage one or may department. not manage any department One and only One (Mandatory One) Zero or One (Optional One) Using foreign key Dr.Girija Narasimhan 26
  • 27. Mapping 1-N Binary Relationship Type Department have one or more employee One or More (Mandatory One) Employee must work only one department. One and only One (Mandatory One) Dr.Girija Narasimhan 27
  • 28. Mapping M-N Binary Relationship Type Employee join one or more project Project has one more employee One or More (Mandatory One) One or More (Mandatory One) Dr.Girija Narasimhan 28
  • 29. Mapping Unary Relation Type one employee appointed as supervisor Dr.Girija Narasimhan 29