Lec 04
Lec 04
Lecture
Course Instructor:
Aisha Shabbir Institute of Geographical Information Systems
Road Map for
• ER Model Today
• Components of ER Model
• Attribute and Relation types
• Data Modeling
• Conceptual Modeling
• Logical Modeling
• Physical Modeling
• Dimensional Modeling
Entity
• An entity is an object, concept or component of data.
An entity might be
1. Object with physical existence. E.g. a lecturer, a student, a car
2. Object with conceptual existence. E.g. a course, a job, a position
ER model
• ER model stands for an Entity-Relationship model.
• This model is used to define the data elements and relationship for a
specified system.
• It is also used in computing in regard to the organization of data
within databases or information systems.
An ER diagram has three main components:
1. Entity
2. Attribute
3. Relationship
Entity
• An entity is an object, concept or component of data.
An entity might be
1. Object with physical existence. E.g. a lecturer, a student, a car
2. Object with conceptual existence. E.g. a course, a job, a position
• An entity is represented as rectangle in an ER diagram.
Examples of entities:
• Person: Employee, Student, Patient
• Place: Store, Building
• Object: Machine, product, and Car
• Event: Sale, Registration, Renewal
• Concept: Account, Course
Attribute
• An attribute describes the property of an entity. An attribute is
represented as Oval in an ER diagram.
Relationship
• Relationship is nothing but an association among two or more
entities.
• A relationship is represented by diamond shape in ER diagram, it
shows the relationship among entities.
Weak entity
• An entity that cannot be uniquely identified by its own attributes is called weak
entity.
• Weak entity depends on another entity
• The weak entity doesn't contain any key attribute of its own.
• The weak entity is represented by a double rectangle.
Strong Entity Set Weak Entity Set
It does not have enough attributes to build a
Strong entity set always has a primary key. primary key.
It is represented by a rectangle symbol. It is represented by a double rectangle symbol
It contains a Primary key represented by the It contains a Partial Key which is represented
underline symbol. by a dashed underline symbol.
The member of a strong entity set is called as The member of a weak entity set called as a
dominant entity set. subordinate entity set.
In the ER diagram the relationship between The relationship between one strong and a
two strong entity set shown by using a weak entity set shown by using the double
diamond symbol. diamond symbol.
The connecting line of the strong entity set The line connecting the weak entity set for
with the relationship is single. identifying relationship is double.
Key attribute
• A key attribute can uniquely identify an entity from an entity set. For example,
student roll number can uniquely identify a student from a set of students.
• Key attribute is represented by oval same as other attributes however the text of
key attribute is underlined.
Composite attribute
• Composite attributes are made of more than one simple attribute. For example, a
student's complete name may have first_name and last_name.
• The composite attribute is represented by an ellipse/oval, and those ellipses are
connected with an ellipse.
Derived attribute
• Derived attribute − Derived attributes are the attributes that do not exist in the
physical database, but their values are derived from other attributes present in
the database. It is represented by dashed oval in an ER Diagram.
• For example, age can be derived from data_of_birth.
Multi-value attribute
• Multi-value attribute − Multi-value attributes may contain more than
one values. For example, a person can have more than one phone
number, email_address, etc. It is represented by double oval in an ER
Diagram.
Types of Relations
There are four types of relationships:
1. One to One
2. One to Many
3. Many to One
4. Many to Many
Cardinality Identification
Example
• In a university, a Student enrolls in Courses. A student must be
assigned to at least one or more Courses. Each course is taught by a
single Professor. To maintain instruction quality, a Professor can
deliver only one course.
Solution
Step 1) Entity Identification
Step 2) Relationship Identification
Step 3) Cardinality Identification
Step 4) Identify Attributes
Step 5) Create the ERD Diagram
Entity Identification
We have three entities
• Student
• Course
• Professor
Step 2) Relationship
Identification
We have the following two relationships
• The student is assigned a course
• Professor delivers a course
Step 3) Cardinality
Identification
• A student can be assigned multiple courses
• A Professor can deliver only one course
Step 4) Identify Attributes