SlideShare a Scribd company logo
1 of 61
Entity
 Entity in DBMS can be a real-world object with an
existence.
 For example, in a College database, the entities can be
Professor, Students, Courses, etc.
 Entities has attributes, which can be considered as
properties describing it, for example, for Professor
entity, the attributes are Professor_Name,
Professor_Address, Professor_Salary, etc. The
attribute value gets stored in the database.
Example of Entity in DBMS
<Professor>
 Here, Professor_Name, Professor _Address and
Professor _Salary are attributes.
Professor_ID is the primary key
Professor_ID Professor_Name Professor_City Professor_Salary
P01 Tom Sydney $7000
P02 David Brisbane $4500
P03 Mark Perth $5000
Types of Entities
 strong entity
 The strong entity has a primary key.
 Weak entities are dependent on strong entity.
Strong Entity
 The strong entity has a primary key.
 Strong Entity is represented by a single rectangle −
 Continuing our previous example, Professor is a strong
entity here, and the primary key is Professor_ID.
Strong
Entity
Weak Entity
 The weak entity in DBMS do not have a primary key and are
dependent on the parent entity. It mainly depends on other
entities.
 Weak Entity is represented by double rectangle −
Weak
entity
Continuing our previous example, Professor is a strong
entity, and the primary key is Professor_ID. However,
another entity is Professor_Dependents, which is our
Weak Entity.
Example of Strong and Weak Entity
 The example of strong and weak entity can be understood
by the below figure.
 The Strong Entity is Professor, whereas Dependent is a
Weak Entity.
 ID is the primary key (represented with a line) and Name
in Dependent entity is called Partial Key (represented
with a dotted line).
Entity Set
 An entity set is a group of similar entities and
these entities can have attributes.
 In terms of DBMS, an entity is a table or attribute of a
table in database, so by showing relationship among tables
and their attributes.
 ER diagram shows the complete logical structure of a
database.
Types of Entity Set
Entity set can be classified into two
categories as shown below:
Strong Entity Set
Weak Entity Set
Strong Entity Set
 An entity set that has a primary key using which,
entities in the table can be uniquely identified. This
kind of entity set is termed as a strong entity set.
Strong entity set is also known as a regular entity set.
 In an ER diagram, the strong entity set is represented
by the rectangle. Here, the primary key is underlined
with the solid line.
Weak Entity Sets
 A weak entity set doesn’t have any primary key which
can identify each entity in a set distinctly. But, for
discriminating the entities in a set, the weak entity set
is dependent on a particular strong entity set.
 A weak entity is also said to be existence dependent as
for the existence of its entities it has to be dependent
on identifying entity set i.e. a particular ‘strong entity
set’. The relation between a weak entity set and a strong
entity set is said to be identifying relationship.

Attributes
 An attribute is a property or characteristic of an
entity. An entity may contain any number of
attributes. One of the attributes is considered as
the primary key. In an Entity-Relation model,
attributes are represented in an elliptical shape.
 Example: Student has attributes like name, age,
roll number and many more. To uniquely
identify the student, we use the primary key as
roll number as it is not repeated. Attributes can
also be subdivided into another set of attributes.
Types of Attributes
1. Simple Attributes-
 Simple attributes are those attributes which can not be
divided further.
 Here, all the attributes are simple attributes as they can
not be divided further.
 Example
2. Composite Attributes-
 Composite attributes are those attributes which are
composed of many other simple attributes.
 Here, the attributes “Name” and “Address” are
composite attributes as they are composed of many
other simple attributes.
 Example-
3. Single Valued Attributes-
 Single valued attributes are those attributes which can
take only one value for a given entity from an entity set.
 Here, all the attributes are single valued attributes as they
can take only one specific value for each entity.
 Example
4. Multi Valued Attributes
 Multi valued attributes are those attributes which can take
more than one value for a given entity from an entity set.
 Here, the attributes “Mob_no” and “Email_id” are multi
valued attributes as they can take more than one values for
a given entity.
 Example
5. Stored attribute
 Stored attribute is an attribute which are
physically stored in the database. Assume a table called as
student. ... We cannot derive value of
these attribute using other attributes. So,
these attributes are called as stored attribute.
 Example
5. Derived Attributes
 Derived attributes are those attributes which can be derived
from other attribute(s).
 Here, the attribute “Age” is a derived attribute as it can be
derived from the attribute “DOB”.
 Example
6. Null Value Attribute
 An attribute, which has not any value for an entity is
known as null valued attribute. For example, assume
Student is an entity and its attributes are Name, Age,
Address and Phone no. There may be chance when a
student has no phone no. In that case, phone no is
called null valued attributes.
 Example
 Middle Name
 E-Mail ID
7. Key Attributes
 Key attributes are those attributes which can identify an
entity uniquely in an entity set.
 Here, the attribute “Roll_no” is a key attribute as it can
identify any student uniquely.
 Example
8. Complex attributes
 The attributes that are formed by arbitrarily nesting the
composite and multivalued attributes are called complex
attributes.
Keys in DBMS
 A key is a set of attributes that can identify
each tuple uniquely in the given relation.
Different Types Of Keys in DBMS
 A super key is a set of attributes that can identify each
tuple(row) uniquely in the given relation(table).
 A super key is not restricted to have any specific number
of attributes.
 Thus, a super key may consist of any number of attributes.
1. Super Key
 Example
 Consider the following Student schema-
 Student ( roll , name , age , address , class ,
section )
 Given below are the examples of super keys since
each set can uniquely identify each student in the
Student table-
 ( roll , name , age , address , class , section )
 ( class , section , roll )
 (class , section , roll )
 ( name , address )
2. Candidate Key
 A minimal super key is called as a candidate key.
OR
 A set of minimal attribute(s) that can identify each tuple
uniquely in the given relation is called as a candidate key.
 Example-
 Consider the following Student schema-
 Student ( roll , name , age , address , class , section )
 Given below are the examples of candidate keys since each
set consists of minimal attributes required to identify each
student uniquely in the Student table-
 ( class , section , roll )
 ( name , address )
NOTES
 All the attributes in a candidate key are sufficient as well
as necessary to identify each tuple uniquely.
 Removing any attribute from the candidate key fails in
identifying each tuple uniquely.
 The value of candidate key must always be unique.
 The value of candidate key can never be NULL.
 It is possible to have multiple candidate keys in a relation.
3. Primary Key
 A primary key is a candidate key that the database
designer selects while designing the database.
OR
 Candidate key that the database designer implements is
called as a primary key.
NOTES
 The value of primary key can never be NULL.
 The value of primary key must always be unique.
 The values of primary key can never be changed i.e. no
updation is possible.
 The value of primary key must be assigned when inserting
a record.
 A relation is allowed to have only one primary key.
4. Alternate Key
 Candidate keys that are left unimplemented or unused
after implementing the primary key are called as alternate
keys.
OR
 Unimplemented candidate keys are called as alternate
keys.
5. Foreign Key
 An attribute ‘X’ is called as a foreign key to some other
attribute ‘Y’ when its values are dependent on the values of
attribute ‘Y’.
 The attribute ‘X’ can assume only those values which are
assumed by the attribute ‘Y’.
 Here, the relation in which attribute ‘Y’ is present is called
as the referenced relation.
 The relation in which attribute ‘X’ is present is called as
the referencing relation.
 The attribute ‘Y’ might be present in the same table or in
some other table.
NOTES
 Foreign key references the primary key of the table.
 Foreign key can take only those values which are
present in the primary key of the referenced relation.
 Foreign key may have a name other than that of a
primary key.
 Foreign key can take the NULL value.
 There is no restriction on a foreign key to be unique.
 In fact, foreign key is not unique most of the time.
 Referenced relation may also be called as the master
table or primary table.
 Referencing relation may also be called as the foreign
table.
6. Partial Key
 Partial key is a key using which all the records of the table
can not be identified uniquely.
 However, a bunch of related tuples can be selected from
the table using the partial key.
Example
 Consider the following schema-
 Department ( Emp_no , Dependent_name , Relation )
 Here, using partial key Emp_no, we can not identify a
tuple uniquely but we can select a bunch of tuples from
the table.
7. Composite Key
 A primary key comprising of multiple attributes and not
just a single attribute is called as a composite key.
8. Unique Key
 Unique key is a key with the following properties-
 It is unique for all the records of the table.
 Once assigned, its value can not be changed i.e. it is non-
updatable.
 It may have a NULL value.
Example
 The best example of unique key is Adhaar Card
Numbers.
 The Adhaar Card Number is unique for all the citizens
(tuples) of India (table).
 If it gets lost and another duplicate copy is issued, then the
duplicate copy always has the same number as before.
 Thus, it is non-updatable.
 Few citizens may not have got their Adhaar cards, so for
them its value is NULL.
9. Surrogate Key
 Surrogate key is a key with the following properties-
 It is unique for all the records of the table.
 It is updatable.
 It can not be NULL i.e. it must have some value.
 Example-
 Mobile Number of students in a class where every student
owns a mobile phone.
10. Secondary Key
 Secondary key is required for the indexing purpose for
better and faster searching.
Relationships
 Any association between two entity types is called a
relationship. Entities take part in the relationship. It is
represented by a diamond shape.
 For example, A teacher teaches students. Here,
"teaches" is a relationship and this is the relationship
between a Teacher entity and a Student entity.
Degree of relationship type:
 The number of entity sets that participate in a
relationship set.
 The degree of a relationship is the number of
entity types that participate(associate) in
a relationship.
 E-R diagram, we can simply tell the degree of
a relationship i.e the number of an
entity type that is connected to
a relationship is the degree of
that relationship.
Unary Relationship
 Unary relationship exists when an association
is maintained with a single entity.
Binary Relationship:
A binary relationship exists when two
entities are associated.
Ternary Relationship
 A ternary relationship exists when there are
three entities associated.
Constraints on Relationship Types:
 Relationship types usually have certain constraints
that limit the possible combination of entity that
may participate in the relationship instance.
 Ex: If the company has a rule that each employee
must work for exactly one department. The two
main types of constraints are cardinality ration and
participation constraints.
One-to-One:
 An entity in A is associated with at most one
entity in Band vice versa.
One-to-Many:
 An entity of entity set A is associated with two
or more entities of entity set B. However, each
and every entity in entity set B can be
associated with almost one entity in entity set
A.
Many-to-One:
 An entity of entity set A is associated with
almost one entity of entity set B. However, an
entity of entity set B can be associated with
two or more entities of entity set A.
Many-to-Many:
 An entity of entity set A is associated with two or
more entities of entity set B. Similarly, an entity of
entity set B is associated with two or more entities of
entity set A.
Different notations used for ER Diagram
An ER diagram to show student entity details:
An ER diagram to show employee details:
An ER diagram to show employee details:
An ER diagram to show company database:
END

More Related Content

What's hot (20)

Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization 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
 
Database management functions
Database management functionsDatabase management functions
Database management functions
 
Key and its different types
Key and its different typesKey and its different types
Key and its different types
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
 
View of data DBMS
View of data DBMSView of data DBMS
View of data DBMS
 
Rdbms
RdbmsRdbms
Rdbms
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a Database
 
DBMS Keys
DBMS KeysDBMS Keys
DBMS Keys
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
MySQL Data types
MySQL Data typesMySQL Data types
MySQL Data types
 
Degree of relationship set
Degree of relationship setDegree of relationship set
Degree of relationship set
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Sql dml & tcl 2
Sql   dml & tcl 2Sql   dml & tcl 2
Sql dml & tcl 2
 
Trigger
TriggerTrigger
Trigger
 
Rdbms
RdbmsRdbms
Rdbms
 
DML Commands
DML CommandsDML Commands
DML Commands
 

Similar to DBMS Unit 2 ppt.ppt

Module 2 dbms.pptx
Module 2 dbms.pptxModule 2 dbms.pptx
Module 2 dbms.pptxVijishK
 
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database ModelShishir Aryal
 
3. Chapter Three.pdf
3. Chapter Three.pdf3. Chapter Three.pdf
3. Chapter Three.pdffikadumola
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship ModelA. S. M. Shafi
 
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
 
DBMS-Keys , Attributes and Constraints.pptx
DBMS-Keys , Attributes and Constraints.pptxDBMS-Keys , Attributes and Constraints.pptx
DBMS-Keys , Attributes and Constraints.pptxsajinis5
 
Introduction to database-ER Model
Introduction to database-ER ModelIntroduction to database-ER Model
Introduction to database-ER ModelAjit Nayak
 
data base u2 dfhjhdbgjhbfxjjkgfbjkg.pptx
data base u2 dfhjhdbgjhbfxjjkgfbjkg.pptxdata base u2 dfhjhdbgjhbfxjjkgfbjkg.pptx
data base u2 dfhjhdbgjhbfxjjkgfbjkg.pptxmulukendemis44
 
27 f157al5enhanced er diagram
27 f157al5enhanced er diagram27 f157al5enhanced er diagram
27 f157al5enhanced er diagramdddgh
 

Similar to DBMS Unit 2 ppt.ppt (20)

Module 2 dbms.pptx
Module 2 dbms.pptxModule 2 dbms.pptx
Module 2 dbms.pptx
 
rdbmsdol.pptx
rdbmsdol.pptxrdbmsdol.pptx
rdbmsdol.pptx
 
rdbmsdol.pptx
rdbmsdol.pptxrdbmsdol.pptx
rdbmsdol.pptx
 
Data Models.pptx
Data Models.pptxData Models.pptx
Data Models.pptx
 
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database Model
 
UNIT II DBMS.pptx
UNIT II DBMS.pptxUNIT II DBMS.pptx
UNIT II DBMS.pptx
 
Data Models
Data ModelsData Models
Data Models
 
3. Chapter Three.pdf
3. Chapter Three.pdf3. Chapter Three.pdf
3. Chapter Three.pdf
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
Relational Model
Relational ModelRelational Model
Relational Model
 
The Relational Model
The Relational ModelThe Relational Model
The Relational 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
 
DBMS-Keys , Attributes and Constraints.pptx
DBMS-Keys , Attributes and Constraints.pptxDBMS-Keys , Attributes and Constraints.pptx
DBMS-Keys , Attributes and Constraints.pptx
 
Er model
Er modelEr model
Er model
 
Database design
Database designDatabase design
Database design
 
Database design
Database designDatabase design
Database design
 
Introduction to database-ER Model
Introduction to database-ER ModelIntroduction to database-ER Model
Introduction to database-ER Model
 
data base u2 dfhjhdbgjhbfxjjkgfbjkg.pptx
data base u2 dfhjhdbgjhbfxjjkgfbjkg.pptxdata base u2 dfhjhdbgjhbfxjjkgfbjkg.pptx
data base u2 dfhjhdbgjhbfxjjkgfbjkg.pptx
 
enhanced er diagram
enhanced er diagramenhanced er diagram
enhanced er diagram
 
27 f157al5enhanced er diagram
27 f157al5enhanced er diagram27 f157al5enhanced er diagram
27 f157al5enhanced er diagram
 

Recently uploaded

如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证zifhagzkk
 
社内勉強会資料_Object Recognition as Next Token Prediction
社内勉強会資料_Object Recognition as Next Token Prediction社内勉強会資料_Object Recognition as Next Token Prediction
社内勉強会資料_Object Recognition as Next Token PredictionNABLAS株式会社
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNKTimothy Spann
 
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样jk0tkvfv
 
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarjSCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarjadimosmejiaslendon
 
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...Klinik Aborsi
 
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...ThinkInnovation
 
jll-asia-pacific-capital-tracker-1q24.pdf
jll-asia-pacific-capital-tracker-1q24.pdfjll-asia-pacific-capital-tracker-1q24.pdf
jll-asia-pacific-capital-tracker-1q24.pdfjaytendertech
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRajesh Mondal
 
Credit Card Fraud Detection: Safeguarding Transactions in the Digital Age
Credit Card Fraud Detection: Safeguarding Transactions in the Digital AgeCredit Card Fraud Detection: Safeguarding Transactions in the Digital Age
Credit Card Fraud Detection: Safeguarding Transactions in the Digital AgeBoston Institute of Analytics
 
如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样
如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样
如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样wsppdmt
 
Harnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptxHarnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptxParas Gupta
 
Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024patrickdtherriault
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...Elaine Werffeli
 
Displacement, Velocity, Acceleration, and Second Derivatives
Displacement, Velocity, Acceleration, and Second DerivativesDisplacement, Velocity, Acceleration, and Second Derivatives
Displacement, Velocity, Acceleration, and Second Derivatives23050636
 
Pentesting_AI and security challenges of AI
Pentesting_AI and security challenges of AIPentesting_AI and security challenges of AI
Pentesting_AI and security challenges of AIf6x4zqzk86
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Klinik kandungan
 
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATIONCapstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATIONLakpaYanziSherpa
 

Recently uploaded (20)

如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
 
社内勉強会資料_Object Recognition as Next Token Prediction
社内勉強会資料_Object Recognition as Next Token Prediction社内勉強会資料_Object Recognition as Next Token Prediction
社内勉強会資料_Object Recognition as Next Token Prediction
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
 
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
 
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarjSCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
 
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
 
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
 
jll-asia-pacific-capital-tracker-1q24.pdf
jll-asia-pacific-capital-tracker-1q24.pdfjll-asia-pacific-capital-tracker-1q24.pdf
jll-asia-pacific-capital-tracker-1q24.pdf
 
Abortion pills in Riyadh Saudi Arabia| +966572737505 | Get Cytotec, Unwanted Kit
Abortion pills in Riyadh Saudi Arabia| +966572737505 | Get Cytotec, Unwanted KitAbortion pills in Riyadh Saudi Arabia| +966572737505 | Get Cytotec, Unwanted Kit
Abortion pills in Riyadh Saudi Arabia| +966572737505 | Get Cytotec, Unwanted Kit
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for Research
 
Credit Card Fraud Detection: Safeguarding Transactions in the Digital Age
Credit Card Fraud Detection: Safeguarding Transactions in the Digital AgeCredit Card Fraud Detection: Safeguarding Transactions in the Digital Age
Credit Card Fraud Detection: Safeguarding Transactions in the Digital Age
 
如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样
如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样
如何办理澳洲拉筹伯大学毕业证(LaTrobe毕业证书)成绩单原件一模一样
 
Harnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptxHarnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptx
 
Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 
Abortion pills in Jeddah |+966572737505 | get cytotec
Abortion pills in Jeddah |+966572737505 | get cytotecAbortion pills in Jeddah |+966572737505 | get cytotec
Abortion pills in Jeddah |+966572737505 | get cytotec
 
Displacement, Velocity, Acceleration, and Second Derivatives
Displacement, Velocity, Acceleration, and Second DerivativesDisplacement, Velocity, Acceleration, and Second Derivatives
Displacement, Velocity, Acceleration, and Second Derivatives
 
Pentesting_AI and security challenges of AI
Pentesting_AI and security challenges of AIPentesting_AI and security challenges of AI
Pentesting_AI and security challenges of AI
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
 
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATIONCapstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
 

DBMS Unit 2 ppt.ppt

  • 1. Entity  Entity in DBMS can be a real-world object with an existence.  For example, in a College database, the entities can be Professor, Students, Courses, etc.  Entities has attributes, which can be considered as properties describing it, for example, for Professor entity, the attributes are Professor_Name, Professor_Address, Professor_Salary, etc. The attribute value gets stored in the database.
  • 2. Example of Entity in DBMS <Professor>  Here, Professor_Name, Professor _Address and Professor _Salary are attributes. Professor_ID is the primary key Professor_ID Professor_Name Professor_City Professor_Salary P01 Tom Sydney $7000 P02 David Brisbane $4500 P03 Mark Perth $5000
  • 3. Types of Entities  strong entity  The strong entity has a primary key.  Weak entities are dependent on strong entity.
  • 4. Strong Entity  The strong entity has a primary key.  Strong Entity is represented by a single rectangle −  Continuing our previous example, Professor is a strong entity here, and the primary key is Professor_ID. Strong Entity
  • 5. Weak Entity  The weak entity in DBMS do not have a primary key and are dependent on the parent entity. It mainly depends on other entities.  Weak Entity is represented by double rectangle − Weak entity Continuing our previous example, Professor is a strong entity, and the primary key is Professor_ID. However, another entity is Professor_Dependents, which is our Weak Entity.
  • 6. Example of Strong and Weak Entity  The example of strong and weak entity can be understood by the below figure.  The Strong Entity is Professor, whereas Dependent is a Weak Entity.  ID is the primary key (represented with a line) and Name in Dependent entity is called Partial Key (represented with a dotted line).
  • 7. Entity Set  An entity set is a group of similar entities and these entities can have attributes.  In terms of DBMS, an entity is a table or attribute of a table in database, so by showing relationship among tables and their attributes.  ER diagram shows the complete logical structure of a database.
  • 8. Types of Entity Set Entity set can be classified into two categories as shown below: Strong Entity Set Weak Entity Set
  • 9. Strong Entity Set  An entity set that has a primary key using which, entities in the table can be uniquely identified. This kind of entity set is termed as a strong entity set. Strong entity set is also known as a regular entity set.  In an ER diagram, the strong entity set is represented by the rectangle. Here, the primary key is underlined with the solid line.
  • 10. Weak Entity Sets  A weak entity set doesn’t have any primary key which can identify each entity in a set distinctly. But, for discriminating the entities in a set, the weak entity set is dependent on a particular strong entity set.  A weak entity is also said to be existence dependent as for the existence of its entities it has to be dependent on identifying entity set i.e. a particular ‘strong entity set’. The relation between a weak entity set and a strong entity set is said to be identifying relationship. 
  • 11. Attributes  An attribute is a property or characteristic of an entity. An entity may contain any number of attributes. One of the attributes is considered as the primary key. In an Entity-Relation model, attributes are represented in an elliptical shape.  Example: Student has attributes like name, age, roll number and many more. To uniquely identify the student, we use the primary key as roll number as it is not repeated. Attributes can also be subdivided into another set of attributes.
  • 13. 1. Simple Attributes-  Simple attributes are those attributes which can not be divided further.  Here, all the attributes are simple attributes as they can not be divided further.  Example
  • 14. 2. Composite Attributes-  Composite attributes are those attributes which are composed of many other simple attributes.  Here, the attributes “Name” and “Address” are composite attributes as they are composed of many other simple attributes.  Example-
  • 15. 3. Single Valued Attributes-  Single valued attributes are those attributes which can take only one value for a given entity from an entity set.  Here, all the attributes are single valued attributes as they can take only one specific value for each entity.  Example
  • 16. 4. Multi Valued Attributes  Multi valued attributes are those attributes which can take more than one value for a given entity from an entity set.  Here, the attributes “Mob_no” and “Email_id” are multi valued attributes as they can take more than one values for a given entity.  Example
  • 17. 5. Stored attribute  Stored attribute is an attribute which are physically stored in the database. Assume a table called as student. ... We cannot derive value of these attribute using other attributes. So, these attributes are called as stored attribute.  Example
  • 18. 5. Derived Attributes  Derived attributes are those attributes which can be derived from other attribute(s).  Here, the attribute “Age” is a derived attribute as it can be derived from the attribute “DOB”.  Example
  • 19. 6. Null Value Attribute  An attribute, which has not any value for an entity is known as null valued attribute. For example, assume Student is an entity and its attributes are Name, Age, Address and Phone no. There may be chance when a student has no phone no. In that case, phone no is called null valued attributes.  Example  Middle Name  E-Mail ID
  • 20. 7. Key Attributes  Key attributes are those attributes which can identify an entity uniquely in an entity set.  Here, the attribute “Roll_no” is a key attribute as it can identify any student uniquely.  Example
  • 21. 8. Complex attributes  The attributes that are formed by arbitrarily nesting the composite and multivalued attributes are called complex attributes.
  • 22. Keys in DBMS  A key is a set of attributes that can identify each tuple uniquely in the given relation.
  • 23. Different Types Of Keys in DBMS
  • 24.  A super key is a set of attributes that can identify each tuple(row) uniquely in the given relation(table).  A super key is not restricted to have any specific number of attributes.  Thus, a super key may consist of any number of attributes. 1. Super Key
  • 25.  Example  Consider the following Student schema-  Student ( roll , name , age , address , class , section )  Given below are the examples of super keys since each set can uniquely identify each student in the Student table-  ( roll , name , age , address , class , section )  ( class , section , roll )  (class , section , roll )  ( name , address )
  • 26. 2. Candidate Key  A minimal super key is called as a candidate key. OR  A set of minimal attribute(s) that can identify each tuple uniquely in the given relation is called as a candidate key.  Example-  Consider the following Student schema-  Student ( roll , name , age , address , class , section )  Given below are the examples of candidate keys since each set consists of minimal attributes required to identify each student uniquely in the Student table-  ( class , section , roll )  ( name , address )
  • 27. NOTES  All the attributes in a candidate key are sufficient as well as necessary to identify each tuple uniquely.  Removing any attribute from the candidate key fails in identifying each tuple uniquely.  The value of candidate key must always be unique.  The value of candidate key can never be NULL.  It is possible to have multiple candidate keys in a relation.
  • 28. 3. Primary Key  A primary key is a candidate key that the database designer selects while designing the database. OR  Candidate key that the database designer implements is called as a primary key.
  • 29. NOTES  The value of primary key can never be NULL.  The value of primary key must always be unique.  The values of primary key can never be changed i.e. no updation is possible.  The value of primary key must be assigned when inserting a record.  A relation is allowed to have only one primary key.
  • 30. 4. Alternate Key  Candidate keys that are left unimplemented or unused after implementing the primary key are called as alternate keys. OR  Unimplemented candidate keys are called as alternate keys.
  • 31. 5. Foreign Key  An attribute ‘X’ is called as a foreign key to some other attribute ‘Y’ when its values are dependent on the values of attribute ‘Y’.  The attribute ‘X’ can assume only those values which are assumed by the attribute ‘Y’.  Here, the relation in which attribute ‘Y’ is present is called as the referenced relation.  The relation in which attribute ‘X’ is present is called as the referencing relation.  The attribute ‘Y’ might be present in the same table or in some other table.
  • 32. NOTES  Foreign key references the primary key of the table.  Foreign key can take only those values which are present in the primary key of the referenced relation.  Foreign key may have a name other than that of a primary key.  Foreign key can take the NULL value.  There is no restriction on a foreign key to be unique.  In fact, foreign key is not unique most of the time.  Referenced relation may also be called as the master table or primary table.  Referencing relation may also be called as the foreign table.
  • 33. 6. Partial Key  Partial key is a key using which all the records of the table can not be identified uniquely.  However, a bunch of related tuples can be selected from the table using the partial key.
  • 34. Example  Consider the following schema-  Department ( Emp_no , Dependent_name , Relation )  Here, using partial key Emp_no, we can not identify a tuple uniquely but we can select a bunch of tuples from the table.
  • 35. 7. Composite Key  A primary key comprising of multiple attributes and not just a single attribute is called as a composite key.
  • 36. 8. Unique Key  Unique key is a key with the following properties-  It is unique for all the records of the table.  Once assigned, its value can not be changed i.e. it is non- updatable.  It may have a NULL value.
  • 37. Example  The best example of unique key is Adhaar Card Numbers.  The Adhaar Card Number is unique for all the citizens (tuples) of India (table).  If it gets lost and another duplicate copy is issued, then the duplicate copy always has the same number as before.  Thus, it is non-updatable.  Few citizens may not have got their Adhaar cards, so for them its value is NULL.
  • 38. 9. Surrogate Key  Surrogate key is a key with the following properties-  It is unique for all the records of the table.  It is updatable.  It can not be NULL i.e. it must have some value.  Example-  Mobile Number of students in a class where every student owns a mobile phone.
  • 39. 10. Secondary Key  Secondary key is required for the indexing purpose for better and faster searching.
  • 40. Relationships  Any association between two entity types is called a relationship. Entities take part in the relationship. It is represented by a diamond shape.  For example, A teacher teaches students. Here, "teaches" is a relationship and this is the relationship between a Teacher entity and a Student entity.
  • 41. Degree of relationship type:  The number of entity sets that participate in a relationship set.  The degree of a relationship is the number of entity types that participate(associate) in a relationship.  E-R diagram, we can simply tell the degree of a relationship i.e the number of an entity type that is connected to a relationship is the degree of that relationship.
  • 42. Unary Relationship  Unary relationship exists when an association is maintained with a single entity.
  • 43. Binary Relationship: A binary relationship exists when two entities are associated.
  • 44. Ternary Relationship  A ternary relationship exists when there are three entities associated.
  • 45. Constraints on Relationship Types:  Relationship types usually have certain constraints that limit the possible combination of entity that may participate in the relationship instance.  Ex: If the company has a rule that each employee must work for exactly one department. The two main types of constraints are cardinality ration and participation constraints.
  • 46. One-to-One:  An entity in A is associated with at most one entity in Band vice versa.
  • 47. One-to-Many:  An entity of entity set A is associated with two or more entities of entity set B. However, each and every entity in entity set B can be associated with almost one entity in entity set A.
  • 48. Many-to-One:  An entity of entity set A is associated with almost one entity of entity set B. However, an entity of entity set B can be associated with two or more entities of entity set A.
  • 49. Many-to-Many:  An entity of entity set A is associated with two or more entities of entity set B. Similarly, an entity of entity set B is associated with two or more entities of entity set A.
  • 50.
  • 51.
  • 52.
  • 53. Different notations used for ER Diagram
  • 54.
  • 55. An ER diagram to show student entity details:
  • 56.
  • 57. An ER diagram to show employee details:
  • 58. An ER diagram to show employee details:
  • 59. An ER diagram to show company database:
  • 60.
  • 61. END