Pod Notes
Pod Notes
Pod Notes
1 A 2223
2 A 555555
2. ENTITIES
1.It is a collection of objects.
2.An entity is an object that is distinguishable from other objects by a set of
attributes.
3.This is the basic object of E-R Model, which is a 'thing' in the real world
with an independent existence.
4.An entity may be an 'object' with a physical existence.
5.Entities can be represented by 'Ellipses'.Example:i.Customer, account
etc.
3. ATTRIBUTES
Characteristics of an entity are called as an attribute.The properties of a
particular entity are called as attributes of that specified entity.
Example:Name, street_address, city ---customer database.Acc-no, balance
---account database.
Types:These can be classified into following types.
1.Simple Attributes.
2.Composite Attributes.
3.Single Valued Attributes.
4.Mutivalued Attributes.
5.Stored Attributes.
6.Derived Attributes.
Explanation is as below
1.Simple Attributes:
The attributes that are not divisible are called as 'simple or atomic
attributes'.Example:cust_name, acc_no etc..
Example:
A 'College Degree' attribute for a person.i.e, one person may not have a
college degree, another person may have one and a third person may have
2or more degrees.
A multi-valued attribute may have lower and upper bounds on the number
of values allowed for each individual entity.
5.Derived Attributes:
An attribute which is derived from another attribute is called as a ‘derived
attribute.
Example:‘Age’ attribute is derived from another attribute ‘Date’.
6.Stored Attribute:
An attribute which is not derived from another attribute is called as a ‘stored
attribute.
Example:In the above example,’ Date’ is a stored attribute.
Types of Attributes-
In ER diagram, attributes associated with an entity set may be of the following types-
1. Simple attributes
2. Composite attributes
3. Single valued attributes
4. Multi valued attributes
5. Derived attributes
6. Key attributes
1. Simple Attributes-
Simple attributes are those attributes which can not be divided further.
Example-
Here, all the attributes are simple attributes as they can not be divided further.
2. Composite Attributes-
Composite attributes are those attributes which are composed of many other simple attributes.
Example-
Here, the attributes “Name” and “Address” are composite attributes as they are composed of
many other simple attributes.
Single valued attributes are those attributes which can take only one value for a given entity from
an entity set.
Example-
Here, all the attributes are single valued attributes as they can take only one specific value for
each entity.
Multi valued attributes are those attributes which can take more than one value for a given entity
from an entity set.
Example-
Here, the attributes “Mob_no” and “Email_id” are multi valued attributes as they can take more
than one values for a given entity.
5. Derived Attributes-
Derived attributes are those attributes which can be derived from other attribute(s).
Example-
Here, the attribute “Age” is a derived attribute as it can be derived from the attribute “DOB”.
6. Key Attributes-
Key attributes are those attributes which can identify an entity uniquely in an entity set.
Example-
Here, the attribute “Roll_no” is a key attribute as it can identify any student uniquely.
4.ENTITY SETS
Entity Type:
A collection entities that have the same attributes is called as an 'entity
type'.Each entity type is described by its name and attributes.
Entity Set:
Collection of all entities of a particular entity type in the database at any
point of time is called as an entity set.
The entity set is usually referred to using the same name as the entity type.
An entity type is represented in ER diagrams as a rectangular box
enclosing the entity type name.
Example:Collection of customers.
5.Relationships
It is an association among entities.
6.Relationship Set
It is a collection of relationships
In One - to - One Relationship, one entity is related with only one other entity.
One row in a table is linked with only one row in another table and vice versa.
For example: A Country can have only one Capital City.
In Many - to - One Relationship, many entities can be related with only one other entity.
For example: No. of Employee works for Department.
Multiple rows in Employee table is related with only one row in Department table.
In Many - to - Many Relationship, many entities are related with the multiple other
entities.
This relationship is a type of cardinality which refers the relation between two entities.
For example: Various Books in a Library are issued by many Students.
Participation Constraints
Following are the two types of Participation Constraints,
1. Total Participation
2. Partial Participation
1. Total Participation
In Total Participation, every entity in the set is involved in some association of the
relationship.
It is indicated by a double line ( ) between entity and relationship.
For example: Every Department must have a Manager.
2. Partial Participation
In Partial Participation, not all entities in the set are involved in association of the
relationship.
It is indicated by a single line ( ) between entity and relationship.
Mapping Cardinalities:
Mapping cardinalities or cardinality ratios, express the number of entities to which
another entity can be associated via a relationship set.
Mapping cardinalities are most useful in describing binary relationship sets, although
they can contribute to the description of relationship sets that involve more than two
entity sets.
For a binary relationship set R between entity sets A and B, the mapping cardinalities
must be one of the following:
one to one:
One to many:
1 M
Course Teach Faculty
es
Many –to-many:
Entities in A and B are associated with any number of entities from each other.
1 M
Customer Depos Account
it
Keys:
Super key:
A super key is a set of one or more attributes that taken collectively, allow us to
identify uniquely an entity in the entity set.
For example , customer-id,(cname,customer-id),(cname,telno)
Candidate key:
In a relation R, a candidate key for R is a subset of the set of attributes of R, which
have the following properties:
• Uniqueness:no two distinct tuples in R have the same values for the
candidate key
• Irreducible:No proper subset of the candidate key has the uniqueness
property that is the candidate key.
Eg: (cname,telno)
Primary key:
The primary key is the candidate key that is chosen by the database designer as the
principal means of identifying entities with in an entity set. The remaining candidate
keys if any, are called alternate key.
ER Diagrams
ERD stands for Entity Relationship diagram.
It is a graphical representation of an information system.
ER diagram shows the relationship between objects, places, people, events etc. within
that system.
It is a data modeling technique which helps in defining the business process.
It used for solving the design problems.
Multi valued It represents multi valued attribute which can have many
Attribute values for a particular entity. For eg. Mobile Number.
EER Model
As the complexity of data increased in the late 1980s, it became more and more difficult to use
the traditional ER Model for database modelling. Hence some improvements or enhancements
were made to the existing ER Model to make it able to handle the complex applications better.
Hence, as part of the Enhanced ER Model, along with other improvements, three new concepts
were added to the existing ER Model, they were:
1. Generalization
2. Specialization
3. Aggregration
Let's understand what they are, and why were they added to the existing ER Model.
EER is a high-level data model that incorporates the extensions to the original ER model.
Sub class and Super class relationship leads the concept of Inheritance.
1. Sub Class
A subclass is a class derived from the superclass. It inherits the properties of the superclass and
also contains attributes of its own
The relationship between sub class and super class is denoted with symbol.
1. Super Class
A superclass is the class from which many subclasses can be created. The subclasses
inherit the characteristics of a superclass. The superclass is also known as the parent class
or base class.
In the above example, Vehicle is the Superclass and its subclasses are Car, Truck and
Motorcycle.Super class is an entity type that has a relationship with one or more
subtypes.
An entity cannot exist in database merely by being member of any super class.
For example: Shape super class is having sub groups as Square, Circle, Triangle.
1. Generalization
Generalization is a bottom-up approach in which two lower level entities combine to form a
higher level entity. In generalization, the higher level entity can also combine with other lower
level entities to make further higher level entity.
It's more like Superclass and Subclass system, but the only difference is the approach, which is
bottom-up. Hence, entities are combined to form a more generalised entity, in other words, sub-
classes are combined to form a super-class.
For example, Saving and Current account types entities can be generalised and an entity
with name Account can be created, which covers both.
________________________________________
In the above example, Tiger, Lion, Elephant can all be generalized as Animals.
2. Specialization
Specialization is opposite to Generalization. It is a top-down approach in which one higher level
entity can be broken down into two lower level entity. In specialization, a higher level entity may
not have any lower-level entity sets, it's possible.
Specialization is a process that defines a group entities which is divided into sub groups
based on their characteristic.
It is a top down approach, in which one higher entity can be broken down into two lower
level entity.
It maximizes the difference between the members of an entity by identifying the unique
characteristic or attributes of each member.
It defines one or more sub class for the super class and also forms the superclass/subclass
relationship.
For example
In the above example, Employee can be specialized as Developer or Tester, based on what role
they play in an Organization.
Aggregration
Aggregration is a process when relation between two entities is treated as a single entity.
In the diagram above, the relationship between Center and Course together, is acting as an
Entity, which is in relationship with another entity Visitor. Now in real world, if a Visitor or a
Student visits a Coaching Center, he/she will never enquire about the center only or just about
the course, rather he/she will ask enquire about both.
Aggregation is a process in which a single entity alone is not able to make sense in a relationship
so the relationship of two entities acts as one entity. I know it sounds confusing but don’t worry
the example we will take, will clear all the doubts.
Aggregration Example
DBMS Aggregration Example
In real world, we know that a manager not only manages the employee working under them but
he has to manage the project as well. In such scenario if entity “Manager” makes a “manages”
relationship with either “Employee” or “Project” entity alone then it will not make any sense
because he has to manage both. In these cases the relationship of two entities acts as one entity.
In our example, the relationship “Works-On” between “Employee” & “Project” acts as one entity
that has a relationship “Manages” with the entity “Manager”.
empno name
dob
employee
Generalization Specialization
Is Is
degree degree
Is Is Is Is
Faculty(empno,degree,intrest)
EMPLOYEE(empno,name,dob) Staff(empno,hour-rate)
FULL_TIME_EMPLOYEE(empno,sala Teaching (empno,stipend)
ry)
PART_TIME_EMPLOYEE(empno,type)
ER- Diagram For College Database
Head
name dnam of 1 name sal
1
addres relationship
Date