Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
1
Conceptual Level
• Conceptual Level is a detailed specification of overall structure of data. That is,
detailed specification of WHAT data to be stored.
• ER diagram is used to represent conceptual level.
Entity Relationship Diagram(ER diagram)
• ER diagram is a logical representation of a data for an organization or
business.
• ER is a graphical representation of data.
• ER diagram consist of
i. Entity
ii. Attributes
iii. Relationship
ENTITY
 Definition: An entity is a person, place, object, event, or concept about
which we or organization want to store data.
 Example
Person: Student, Teacher, Employee
Place: ClassRoom, StoreRoom, Lab, Department
Object: Computer, Equipment
Event: Teaching related, registration , examination
Concept: Course
 Types of Entity
• Strong Entity and Weak Entity
Strong Entity Weak Entity
An entity that exists independently of other
entity.
An entity that depend upon some other
entity.
For Example :
Student, Employee, Course
For Example:
Lab, ClassRoom, Department
Department doesnot exist without
employee
Representation on ER Diagram
1. It is represented using Rectangle
2. Name of the entity is written in
capital letter inside rectangle
Representation on ER Diagram
1. It is represented using double
Rectangle
2. Name of the entity is written in
capital letter inside double rectangle
DEPARTMENT
EMPLOYEE
2
ATTRIBUTES
 Definition:
• Each entity has some properties or characteristics that are required
to be stored. It is known as attributes of the entity.
• What we want to store about entity is called its attributes
 Example: Store Attendance of Student
Entity: Student
Attributes:
Rollno
Name
Class
Semester
Date
Status(Present or Absent)
 DOMAIN of Attributes
o The possible or allowed values of any attribute are known as its
domain.
o Example
 Student_Gender: Allowed values (domain) are Male, Female and
Other.
 Student_Caste: Possible or allowed values are SC,ST, OBC, Gen.
(domain of caste)
 There is girls college. So what would be domain of
Student_Gender(Female)
 Age of Employee: possible values or domain must be any value
between 20 to 70.
 Name of student/employee: not allowed numbers and symbols.
Set of string made using alphabets A to Z
3
 Types of Attributes
• Simple and Composite Attribute
• Single Valued Attribute and Multiple valued attribute
Simple Attribute Composite Attribute
Attribute that cannot be divided into parts
is called simple attribute.
Attribute that can be divided into parts is
called composite attribute
For Example
RegistrationNo
StudentId
RollNo
AadharNo
EmailId
Caste
Gender
For Example
Name(First Name, Middle Name, LastName)
DateofBirth(DD, MM, YY)
Address(HNo, City, State, Country, Pin
Code)
PhoneNo (contrycode, stdcode, number)
Representation on ER Diagram
1. It is represented using ellipse and
name od attribute inside ellipse.
Representation on ER Diagram
Single Valued Attribute Multivalued Attribute
Attribute having ONLY ONE VALUE is called
single valued attribute.
Attribute having MORE THAN ONE VALUE is
called multi valued attribute
Example:
RollNo
Gender (Male, Female, Other)
Caste (possiblevalues:SC, ST, OBC,Gen)
Example :
PhoneNo
Hobbies
Mail Id
Qualification(X,XII, BSc,Msc.)
Representation on ER Diagram
1. It is represented using ellipse and
name inside ellipse
Representation on ER Diagram
1. It is represented using double ellipse
and name inside ellipse
RegistrationNo
Gender Hobbies
FirstName
Name
MiddleName
LastName
4
• Stored Attribute and Derived Attribute
• Unique Attribute: An attribute whose value cannot be duplicate.
Example: RollNo, Enrollment No, AadharNo, Vechile No, Account
No,
Stored Attribute Derived Attribute
Attributes whose cannot be calculated from
other attribute.
Attributes whose value can be calculated
from other related attributes(stored
attribute) is called derived attribute.
Stored Attributes value are stored in the
database.
Derived Attributes are not stored in
database.
Example: DateofBirth
Attendance , basic pay, da, hra
Marks
Example:
Age derived from DateofBirth
NetSalary from atten
Percentage from marks
Representation on ER Diagram
1. It is represented using ellipse and
name inside ellipse
Representation on ER Diagram
1. It is represented using dashed ellipse
and name inside ellipse
DateofBirth Age
RollNo
5
RELATIONSHIP
 Definition: It is an association between one or more entity types.
 In ER diagram, it is represented by diamond symbol containing name of
relationship.
 Type of Relationship
 Based on degree of Relationship: Degree of Relationship means
number of entity participating in a relationship. Three types of
relationship based on degree
• Unary Relationship: A relationship in which only one/single entity
is involved.
• Binary Relationship: A relationship in which two entities are
involved.
• Ternary Relationship: A relationship in which three entities are
involved
 Based on mapping cardinalities
Married
to
PERSON
Study
STUDENT
WORK
EMPLOYEE DEPARTMENT
TEACHER
6
• In case of binary relationship, suppose first entity is A and second
entity is B. Cardinality means number of instances of entity B that
can be associated with each instance of A.
• The mapping cardinalities are
1. One to One : An entity A is associated with one and only one
instance of entity B and entity B is associated with only one
and only entity of A.
Example: HEAD(Department, Employee). Each department can
have ONLY one head. An employee can head only one
department
2. One to Many: An entity A is associated with any number of
entities in B but entity in B is associated with only one of entity
in A.
A student can study many subjects
Student Subjects
Amrit Maths
Jaspreet Physics
Jasmeet Hindi
Sita Chemistry
Gita Home Science
3. Many to One: An entity in A is associated with only one entity
in B but entity in B but entity B is associated with any number
of entities in A.
Example: Many subject are studied by one student
Student Subjects
Amrit Maths
Jaspreet Physics
Jasmeet Hindi
Sita Chemistry
Gita Home Science
STUDENT SUBJECT
study
1 N
STUDENT SUBJECT
study
N 1
7
4. Many to Many: An entity in A is associated with any number
of entities in B and B is associated with any number of entities
in A.
Example: A database is being constructed to keep track of teams and games of
sports. A team has a number of players. It is desired to keep track of the players
participating in the game, their positions in the game and the result of the game.
Draw ER diagram and choose your fav sprots.
Step 1: Identify Entities
a. TEAM
b. GAME
c. PLAYER
Step 2: Identify Attributes
a. TEAM(teamname)
b. GAME(gamename,result)
c. PLAYER(teamname,position, gamename)
Step 3: Identify Relationship
a. HAS(TEAM, PLAYER)
b. PARTICIPLATE(PLAYER, GAME)
gamename teamname
position
gamename result
teamname
TEAM PLAYER
GAME
HAS
PARTICIPATE
8
Extended ER Diagram (EER Diagram)
In a ER diagram, when we specify specialization and generalization that is
known as EER(Extended ER Diagram)
Suppose an organization has four types of employee secretary, engineers ,
salaried and hourly employees. Some of the important attributes of each of
these types are
o SECRETARY(Name, EmpNo, Address,PhoneNo, TypingSpeed)
o ENGINEER(Name, EmpNo, Address,PhoneNo, Eng_type)
o SALARIED EMPLOYEE(Name, EmpNo, Address,PhoneNo, BasicPay)
o HOURLY EMPLOYEE(Name, EmpNo, Address,PhoneNo, AmtPerHour)
Each of these employee types common attributes like Name, EmpNo,
Address and PhoneNo. In addition, each employee have one or more
different attributes. For example typing speed is unique to secretary.
So while designing a conceptual data model, we have
Generalization
 The process of defining new single entity type that contains attributes that
are common in all entities is called generalization.
 The new entity created through generalization is called generic entity or
superclass or supertype.
 It is a top – down approach.
 For example: Define a supertype EMPLOYEE with common attributes. So
after generalization, the entities are
o EMPLOYEE(Name, EmpNo, Address, PhoneNo)
Specialization
 The process of defining different one or more entity types that contain
attributes that are unique to a particular entity is called specialization.
 The different entity type created through specialization is called subclass
or subtype of supertype
 It is reverse of generalization process
 It is a bottom up approach.
 For Example: Define four subtypes with unique attributes. So after
specialization, the entities are
o SECRETARY(TypingSpeed)
o ENGINEER( Eng_type)
o SALARIED EMPLOYEE(BasicPay)
9
o HOURLY EMPLOYEE(AmtPerHour)
Note: In an EER diagram, Generalization and Specialization is depicted by a
triangle labeled ISA.
Generalization and Specialization
ISA
ISA
Name
EmpNo Address
EMPLOYEE PhoneNo
TypingSpeed
SECRETARY
Eng_type
ENGINEER
Basicpay
SALARIED_EMPLOYEE
amtpperhour
HOURLY_EMPLOYEE

More Related Content

ER diagram

  • 1. 1 Conceptual Level • Conceptual Level is a detailed specification of overall structure of data. That is, detailed specification of WHAT data to be stored. • ER diagram is used to represent conceptual level. Entity Relationship Diagram(ER diagram) • ER diagram is a logical representation of a data for an organization or business. • ER is a graphical representation of data. • ER diagram consist of i. Entity ii. Attributes iii. Relationship ENTITY  Definition: An entity is a person, place, object, event, or concept about which we or organization want to store data.  Example Person: Student, Teacher, Employee Place: ClassRoom, StoreRoom, Lab, Department Object: Computer, Equipment Event: Teaching related, registration , examination Concept: Course  Types of Entity • Strong Entity and Weak Entity Strong Entity Weak Entity An entity that exists independently of other entity. An entity that depend upon some other entity. For Example : Student, Employee, Course For Example: Lab, ClassRoom, Department Department doesnot exist without employee Representation on ER Diagram 1. It is represented using Rectangle 2. Name of the entity is written in capital letter inside rectangle Representation on ER Diagram 1. It is represented using double Rectangle 2. Name of the entity is written in capital letter inside double rectangle DEPARTMENT EMPLOYEE
  • 2. 2 ATTRIBUTES  Definition: • Each entity has some properties or characteristics that are required to be stored. It is known as attributes of the entity. • What we want to store about entity is called its attributes  Example: Store Attendance of Student Entity: Student Attributes: Rollno Name Class Semester Date Status(Present or Absent)  DOMAIN of Attributes o The possible or allowed values of any attribute are known as its domain. o Example  Student_Gender: Allowed values (domain) are Male, Female and Other.  Student_Caste: Possible or allowed values are SC,ST, OBC, Gen. (domain of caste)  There is girls college. So what would be domain of Student_Gender(Female)  Age of Employee: possible values or domain must be any value between 20 to 70.  Name of student/employee: not allowed numbers and symbols. Set of string made using alphabets A to Z
  • 3. 3  Types of Attributes • Simple and Composite Attribute • Single Valued Attribute and Multiple valued attribute Simple Attribute Composite Attribute Attribute that cannot be divided into parts is called simple attribute. Attribute that can be divided into parts is called composite attribute For Example RegistrationNo StudentId RollNo AadharNo EmailId Caste Gender For Example Name(First Name, Middle Name, LastName) DateofBirth(DD, MM, YY) Address(HNo, City, State, Country, Pin Code) PhoneNo (contrycode, stdcode, number) Representation on ER Diagram 1. It is represented using ellipse and name od attribute inside ellipse. Representation on ER Diagram Single Valued Attribute Multivalued Attribute Attribute having ONLY ONE VALUE is called single valued attribute. Attribute having MORE THAN ONE VALUE is called multi valued attribute Example: RollNo Gender (Male, Female, Other) Caste (possiblevalues:SC, ST, OBC,Gen) Example : PhoneNo Hobbies Mail Id Qualification(X,XII, BSc,Msc.) Representation on ER Diagram 1. It is represented using ellipse and name inside ellipse Representation on ER Diagram 1. It is represented using double ellipse and name inside ellipse RegistrationNo Gender Hobbies FirstName Name MiddleName LastName
  • 4. 4 • Stored Attribute and Derived Attribute • Unique Attribute: An attribute whose value cannot be duplicate. Example: RollNo, Enrollment No, AadharNo, Vechile No, Account No, Stored Attribute Derived Attribute Attributes whose cannot be calculated from other attribute. Attributes whose value can be calculated from other related attributes(stored attribute) is called derived attribute. Stored Attributes value are stored in the database. Derived Attributes are not stored in database. Example: DateofBirth Attendance , basic pay, da, hra Marks Example: Age derived from DateofBirth NetSalary from atten Percentage from marks Representation on ER Diagram 1. It is represented using ellipse and name inside ellipse Representation on ER Diagram 1. It is represented using dashed ellipse and name inside ellipse DateofBirth Age RollNo
  • 5. 5 RELATIONSHIP  Definition: It is an association between one or more entity types.  In ER diagram, it is represented by diamond symbol containing name of relationship.  Type of Relationship  Based on degree of Relationship: Degree of Relationship means number of entity participating in a relationship. Three types of relationship based on degree • Unary Relationship: A relationship in which only one/single entity is involved. • Binary Relationship: A relationship in which two entities are involved. • Ternary Relationship: A relationship in which three entities are involved  Based on mapping cardinalities Married to PERSON Study STUDENT WORK EMPLOYEE DEPARTMENT TEACHER
  • 6. 6 • In case of binary relationship, suppose first entity is A and second entity is B. Cardinality means number of instances of entity B that can be associated with each instance of A. • The mapping cardinalities are 1. One to One : An entity A is associated with one and only one instance of entity B and entity B is associated with only one and only entity of A. Example: HEAD(Department, Employee). Each department can have ONLY one head. An employee can head only one department 2. One to Many: An entity A is associated with any number of entities in B but entity in B is associated with only one of entity in A. A student can study many subjects Student Subjects Amrit Maths Jaspreet Physics Jasmeet Hindi Sita Chemistry Gita Home Science 3. Many to One: An entity in A is associated with only one entity in B but entity in B but entity B is associated with any number of entities in A. Example: Many subject are studied by one student Student Subjects Amrit Maths Jaspreet Physics Jasmeet Hindi Sita Chemistry Gita Home Science STUDENT SUBJECT study 1 N STUDENT SUBJECT study N 1
  • 7. 7 4. Many to Many: An entity in A is associated with any number of entities in B and B is associated with any number of entities in A. Example: A database is being constructed to keep track of teams and games of sports. A team has a number of players. It is desired to keep track of the players participating in the game, their positions in the game and the result of the game. Draw ER diagram and choose your fav sprots. Step 1: Identify Entities a. TEAM b. GAME c. PLAYER Step 2: Identify Attributes a. TEAM(teamname) b. GAME(gamename,result) c. PLAYER(teamname,position, gamename) Step 3: Identify Relationship a. HAS(TEAM, PLAYER) b. PARTICIPLATE(PLAYER, GAME) gamename teamname position gamename result teamname TEAM PLAYER GAME HAS PARTICIPATE
  • 8. 8 Extended ER Diagram (EER Diagram) In a ER diagram, when we specify specialization and generalization that is known as EER(Extended ER Diagram) Suppose an organization has four types of employee secretary, engineers , salaried and hourly employees. Some of the important attributes of each of these types are o SECRETARY(Name, EmpNo, Address,PhoneNo, TypingSpeed) o ENGINEER(Name, EmpNo, Address,PhoneNo, Eng_type) o SALARIED EMPLOYEE(Name, EmpNo, Address,PhoneNo, BasicPay) o HOURLY EMPLOYEE(Name, EmpNo, Address,PhoneNo, AmtPerHour) Each of these employee types common attributes like Name, EmpNo, Address and PhoneNo. In addition, each employee have one or more different attributes. For example typing speed is unique to secretary. So while designing a conceptual data model, we have Generalization  The process of defining new single entity type that contains attributes that are common in all entities is called generalization.  The new entity created through generalization is called generic entity or superclass or supertype.  It is a top – down approach.  For example: Define a supertype EMPLOYEE with common attributes. So after generalization, the entities are o EMPLOYEE(Name, EmpNo, Address, PhoneNo) Specialization  The process of defining different one or more entity types that contain attributes that are unique to a particular entity is called specialization.  The different entity type created through specialization is called subclass or subtype of supertype  It is reverse of generalization process  It is a bottom up approach.  For Example: Define four subtypes with unique attributes. So after specialization, the entities are o SECRETARY(TypingSpeed) o ENGINEER( Eng_type) o SALARIED EMPLOYEE(BasicPay)
  • 9. 9 o HOURLY EMPLOYEE(AmtPerHour) Note: In an EER diagram, Generalization and Specialization is depicted by a triangle labeled ISA. Generalization and Specialization ISA ISA Name EmpNo Address EMPLOYEE PhoneNo TypingSpeed SECRETARY Eng_type ENGINEER Basicpay SALARIED_EMPLOYEE amtpperhour HOURLY_EMPLOYEE