0% found this document useful (0 votes)
5 views39 pages

Unit 2

This document provides an overview of Relational Database Management Systems (RDBMS) and the Entity-Relationship (ER) model, detailing key concepts such as tables, keys, entity sets, and relationship sets. It explains how to represent these concepts graphically using ER diagrams, including attributes, cardinality constraints, and weak entity sets. Additionally, it covers advanced features like specialization, generalization, and aggregation in database design.

Uploaded by

muskangupta0747
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views39 pages

Unit 2

This document provides an overview of Relational Database Management Systems (RDBMS) and the Entity-Relationship (ER) model, detailing key concepts such as tables, keys, entity sets, and relationship sets. It explains how to represent these concepts graphically using ER diagrams, including attributes, cardinality constraints, and weak entity sets. Additionally, it covers advanced features like specialization, generalization, and aggregation in database design.

Uploaded by

muskangupta0747
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 39

UNIT 2

SUBJECT: DBMS
B.COM IV
FACULTY: TANYA MATHUR
Relational Database
System
• Relational Database System got introduced in which data get
organized as tables and each record forms a row with many
fields or attributes in it.
• Terms in RDBMS
Table- Relation
Row-Tuples
Columns-Attributes
Domain and Feild
Degree and Cardinality
Example of a Relation
attributes
(or columns)

tuples
(or rows)
CONCEPT OF KEYS
• CANDIDATE KEY
• PRIMARY KEY
• ALTERNATE KEY
• FOREIGN KEY
ER model -- Database
Modeling
• The ER data mode was developed to facilitate database design by
allowing specification of an enterprise schema that represents the
overall logical structure of a database.
• The ER data model employs three basic concepts:
• entity sets,
• relationship sets,
• attributes.
• The ER model also has an associated diagrammatic representation,
the ER diagram, which can express the overall logical structure of a
database graphically.
Entity Sets
• An entity is an object that exists and is distinguishable from
other objects.
• Example: specific person, company, event, plant
• An entity set is a set of entities of the same type that share the
same properties.
• Example: set of all persons, companies, trees, holidays
• An entity is represented by a set of attributes; i.e., descriptive
properties possessed by all members of an entity set.
• Example:
• instructor = (ID, name, salary )
course= (course_id, title, credits)
• A subset of the attributes form a primary key of the entity set;
i.e., uniquely identifying each member of the set.
Representing Entity sets
in ER Diagram
 Entity sets can be represented graphically as follows:
• Rectangles represent entity sets.
• Attributes listed inside entity rectangle
• Underline indicates primary key attributes
Relationship Sets
• A relationship is an association among several entities
• A relationship set is a mathematical relation among n  2 entities,
each taken from entity sets.
 Example: we define the relationship set advisor to denote the
associations between students and the instructors who act as their
advisors.
 Pictorially, we draw a line between related entities.
Relationship Sets
(Cont.)
• For instance, the advisor relationship set between entity sets instructor and
student may have the attribute date which tracks when the student started
being associated with the advisor
Representing
Relationship Sets via ER
Diagrams
 Diamonds represent relationship sets.
 An attribute can also be associated with a relationship set.
Roles
• Entity sets of a relationship need not be distinct
• Each occurrence of an entity set plays a “role” in the
relationship
• The labels “course_id” and “prereq_id” are called roles.
Degree of a Relationship Set

• Unary relationshion: eg person (motherhood relation ie


person to person
• Binary relationship
• involve two entity sets (or degree two).
• most relationship sets in a database system are binary.
• Relationships between more than two entity sets are rare.
Most relationships are binary. (More on this later.)
• Example: students work on research projects under the
guidance of an instructor.
• relationship proj_guide is a ternary relationship between
instructor, student, and project
Non-binary Relationship
Sets
• Most relationship sets are binary
• There are occasions when it is more convenient to represent
relationships as non-binary.
• E-R Diagram with a Ternary Relationship
Attributes
• Attribute types:
• Simple and composite attributes.
An attribute that cannot be further subdivided
into components is a simple attribute.
An attribute that can be split into components is
a composite attribute.
• Single-valued and multivalued attributes
• Example: multivalued attribute: phone_numbers
• Derived attributes
• Can be computed from other attributes
• Example: age, given date_of_birth
• Domain – the set of permitted values for each attribute
Composite Attributes

•Composite attributes allow us to divided attributes into subparts (other


attributes).
Representing Complex Attributes
in ER Diagram
Mapping Cardinality
Constraints
• Express the number of entities to which another
entity can be associated via a relationship set.
• Most useful in describing binary relationship sets.
• For a binary relationship set the mapping
cardinality must be one of the following types:
• One to one
• One to many
• Many to one
• Many to many
Representing Cardinality
Constraints in ER Diagram
• We express cardinality constraints by drawing either a directed line
(), signifying “one,” or an undirected line (—), signifying “many,”
between the relationship set and the entity set.

• One-to-one relationship between an instructor and a student :


• A student is associated with at most one instructor via the
relationship advisor
• A student is associated with at most one department via stud_dept
One-to-Many Relationship
• one-to-many relationship between an instructor and a student
• an instructor is associated with several (including 0) students via advisor
• a student is associated with at most one instructor via advisor,
Many-to-One Relationships
• In a many-to-one relationship between an instructor and a student,
• an instructor is associated with at most one student via advisor,
• and a student is associated with several (including 0) instructors via advisor
Many-to-Many
Relationship
• An instructor is associated with several (possibly 0) students via advisor
• A student is associated with several (possibly 0) instructors via advisor
Total and Partial
Participation
 Total participation (indicated by double line): every entity in the entity set
participates in at least one relationship in the relationship set

participation of student in advisor relation is total


 every student must have an associated instructor
 Partial participation: some entities may not participate in any relationship
in the relationship set
• Example: participation of instructor in advisor is partial
Weak Entity Sets
•A weak entity set is one whose
existence is dependent on another
entity, called its identifying entity
•Instead of associating a primary key
with a weak entity, we use the
identifying entity, along with extra
attributes called discriminator to
uniquely identify a weak entity.
Weak Entity Sets (Cont.)
• An entity set that is not a weak entity set is termed a strong
entity set.
• Every weak entity must be associated with an identifying
entity; that is, the weak entity set is said to be existence
dependent on the identifying entity set.
• The identifying entity set is said to own the weak entity set
that it identifies.
• The relationship associating the weak entity set with the
identifying entity set is called the identifying relationship.
• Note that the relational schema we eventually create from
the entity set section does have the attribute course_id, for
reasons that will become clear later, even though we have
dropped the attribute course_id from the entity set section.
Expressing Weak Entity
Sets
• In E-R diagrams, a weak entity set is depicted via a double rectangle.
• We underline the discriminator of a weak entity set with a dashed line.
• The relationship set connecting the weak entity set to the identifying strong
entity set is depicted by a double diamond.
• Primary key for section – (course_id, sec_id, semester, year)
E-R Diagram for a University
Enterprise
Extended E-R
Features
Specialization
• Top-down design process; we designate sub-groupings
within an entity set that are distinctive from other entities
in the set.
• These sub-groupings become lower-level entity sets that
have attributes or participate in relationships that do not
apply to the higher-level entity set.
•(e.g., instructor “is a” person).
• Attribute inheritance – a lower-level entity set inherits all
the attributes and relationship participation of the higher-
level entity set to which it is linked.
Generalization

• A bottom-up design process – combine a number of entity


sets that share the same features into a higher-level entity
set.
• Specialization and generalization are simple inversions of
each other; they are represented in an E-R diagram in the
same way.
• The terms specialization and generalization are used
interchangeably.
Aggregation
 Eliminate this redundancy via aggregation without introducing
redundancy, the following diagram represents:
• A student is guided by a particular instructor on a particular
project
• A student, instructor, project combination may have an associated
evaluation
Summary of Symbols Used in
E-R Notation
Symbols Used in E-R
Notation (Cont.)
The End

You might also like