Unit2Data Models
Unit2Data Models
Er. सा हि त बरा ल
May 9/2022
Data Models
Conceptual, Logical and Physical Model
Conceptual Data Model
◦ A conceptual data model identifies the highest-level relationships between the
different entities.
◦ Features of conceptual data model include:
◦ Includes the important entities and the relationships among them.
◦ No attribute is specified.
◦ No primary key is specified.
Data Models
Conceptual Data Model
◦ The figure below is an example of a conceptual data model.
Note: In E-R model we don't represent the data but we represent the structure or schema
Entity and Entity Sets
Entity Type
◦ It is a collection of the entity having common attributes
The E-R
representation of the
above Student Entity
Type is done below
Note: We use a rectangle to represent an entity type in the E-R diagram, not entity
Entity and Entity Sets
Entity Sets
◦ Entity Set is a collection of entities of the same entity type
◦ Example: In the below example, two entities E1 (2, Angel, 19, 8709054568)
and E2(4, Analisa, 21, 9847852156) form an entity set
Entity and Entity Sets
Types of Entity type
• Strong Entity Type
• Weak Entity Type
Here, the attributes “Name” and “Address” are composite attributes as they are
composed of many other simple attributes.
Attributes
Single valued attributes
◦ Single valued attributes are those attributes which can take only one value for
a given entity from an entity set
Attributes
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
Attributes
Derived attributes
◦ Derived attributes are those attributes which can be derived from other
attribute(s)
Attributes
Key attributes
◦ Key attributes are those attributes which can identify an entity uniquely in an
entity set
Attributes
Null value attributes
◦ An attribute, which has not any value for an entity is known as null valued
attribute
◦ For e.g. one student does not have a phone number
Relationship and Relationship Sets
• Relationship defines an association among several entities
• A relationship set is a set of same type of relationships
‘Enrolled in’ is a relationship that exists between entities Student and Course
◦ Types of Relationship
- Strong Relationship set
- Weak Relationship set
Relationship and Relationship Sets
Strong Relationship Set
• A strong relationship exists between two strong entity sets
• It is represented using a diamond symbol
Weak Relationship Set (Identifying)
• A weak relationship exists between the strong and weak entity set
• It is represented using a double diamond symbol
Relationship and Relationship Sets
Degree of Relationship
◦ Number of entity set that participate in a relationship is called degree of
relationship
◦ Mapping Cardinalities
◦ Participation constraints
Mapping Cardinality Constraints
◦ The number of times an entity set participates in a relationship set is known as
cardinality
◦ It is most useful in describing binary relationship sets
◦ One ( ) and many ( )
◦ For binary relationship set R on an entity set A and B, there are four possible
mapping cardinalities
1.One to one (1:1)
2.One to many (1:M)
3.Many to one (M:1)
4.Many to many (M:M)
Mapping Cardinality Constraints
One to One (1:1)
◦ In one-to-one mapping, An entity in A is associated with at most (only) one
entity in B and an entity in B is associated with at most(only) one entity in A
Mapping Cardinality Constraints
One to One (1:1) Relationship
M
N
Student Enrolled In Extra Courses
C1
S1 R1
S2 R2
C2
S3 R3
S4 R4
C3
Keys
◦ Key is used to uniquely identify any record or row of data inside table
◦ It also used to established and identify relationship between tables
Types of Key
◦ Super Key
◦ Candidate Key
◦ Primary Key
Super Key
◦ A super key of an entity set is a set of one or more attributes whose values
uniquely determine each entity in the entity set
◦ If k is a key attribute and any superset of k is also super key
Sid Name Phone Age
1 Praveen 987643214 27
2 Bikal 987654123 25
3 Kiran 985682356 26
4 Puspa 984586932 27
5 Season 985505896 26
Candidate Key
◦ Candidate keys are defined as the minimal set of field which can uniquely
identified each record in table
◦ Candidate Key = Super key whose proper subset is not a super key
◦ It is an attribute or set of attribute that can act as a primary key to identify
each record in the table
DeptCode DeptName
001 Science
002 English
005 Computer
Foreign Key
◦ It is a column that creates a relationship between two tables.
◦ The purpose of Foreign keys is to maintain data integrity and allow navigation
between two different instances of an entity.
◦ It acts as a cross-reference between two tables as it references the primary
key of another table.
1 Married 1
Male Female
to
1
Student M Enrolled In Course
M
Student 1
Enrolled In Course
N
Student M
Enrolled In Course
Course Table
Student Table
Sid Cid
Enrolled Table
The relational schema for the ER Diagram is
given below as:
• Staff( StaffID , dob , address , WifeID)
• Wife ( WifeID , name )
• Child( ChildID , name , StaffID )
• Task ( TaskID , description)
• Perform(PerformID , StaffID , TaskID )
• Phone(PhoneID , phoneNumber , StaffID)