0% found this document useful (0 votes)
23 views42 pages

Database Management Systems

Uploaded by

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

Database Management Systems

Uploaded by

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

DATABASE

MANAGEMENT
SYSTEMS
OVERVIEW OF DBMS DESIGN PROCESS

Choose the
Characterize the Review the
correct data Implementation:
data schema
model.
• Specification of • E-R Model is • Check if the • Logical Design
user used to functional Phase
requirements. represent the requirements • Physical Design
conceptual are met Phase
schema.
ENTITY –RELATIONSHIP MODEL (E-R MODEL)
3 aspects of E-R Model are:
1. Entity Sets
2. Relationship Sets
3. Attributes
ENTITY SETS
• Entity is a thing or object that is distinguishable from all other
objects.
Eg: Every Person in the university is an entity
• There are some unique properties that define an entity
Eg: Student id
• Entity Set: A set of entities of the same type that share same
properties or attributes.
Eg: Entity set of students
• Entity is represented by a set of attributes.
Eg: Attributes of Instructor(ID, DEPT NAME, SALARY)
• Entity Set is represented by a rectangle which has 2 parts:
1. Name of the Entity
2. Names of all attributes of the entity Set
RELATIONSHIP SETS
• Relationship is an association among different entities.
• A relationship set is a set of relationships of the same type.
Ex: Relationship set advisor denotes the association
between students and instructors.
• It is represented by a diamond shape in the E-R Model.
• The function that an entity plays in a relationship is
called its role.
• Descriptive attributes:
Represented by an undivided rectangle which are linked
to the rectangle using a dashed line.
• Complex E-R designs may need to be split into multiple
diagrams located in different pages.

• Relationship sets should be shown in only one location,


but entity sets may be repeated in more than one location.

• The attributes of an entity set should be shown in the first


occurrence. (to avoid repetition and inconsistency)
DEGREE OF A RELATIONSHIP SET

• The number of entity sets that participate in a relationship set is


the degree of the relationship set.
• The relationship sets advisor and takes provide examples of a
binary relationship set—that is, one that involves two entity sets
and its degree is 2.
ATTRIBUTES
• For each attribute, there is a set of permitted values, called the
domain.
• Attribute Types:
1. Simple and composite attributes
Simple Attributes are not divided into subparts and Complex
Attribute is divided into subparts.
Eg: Attribute Name can be divided into subparts First
Name, Middle Name, Last Name
2. Single-valued and multivalued attributes

Single valued attribute has a single value for a particular entity.


Multivalued attribute has more than one value for a particular entity.
Eg: . An instructor may have zero, one, or several phone numbers
3. Derived Attributes
This type of attribute can be derived from the values of other related attributes or
entities.
Eg: suppose that an entity set has an attribute age .
If the same entity set also has an attribute date of birth, we can calculate
age from date of birth and the current date. Thus, age is a derived attribute
MAPPING CARDINALITIES
• They express the number of entities to which another entity can
be associated via a relationship set.
• For a binary relationship set R between entity sets A and B, the
mapping cardinality must be one of the following:
1. One-to-one.
2. One-to-many
3. Many-to-one
4. Many-to-Many
One-to-One
An entity in A is associated with at most one entity in B, and an entity in B is associated
with at most one entity in A
One to Many
An entity in A is associated with any number (zero or more) of entities in B. An entity in B,
however, can be associated with at most one entity in A.
Many-to-One:
An entity in A is associated with at most one entity in B. An entity in B, however, can be
associated with any number (zero or more) of entities in A
Many-to-Many
An entity in A is associated with any number (zero or more) of entities in B, and an
entity in B is associated with any number (zero or more) of entities in A.
• The participation of an entity set E in a relationship set R is said to be total if every
entity in E must participate in at least one relationship in R.

If some entities in E do not participate in relationships in R, the participation of entity set


E in relationship R is said to be partial.
KEYS
• Keys gives a way to identify each entity separately.

• No two entities are allowed to have exactly the same value for all
attributes.

• A superkey is a set of one or more attributes that, taken


collectively, allow us to identify uniquely an entity in the relation.
Eg : ID attribute of the relation instructor is sufficient to
distinguish one instructor from another. So, ID is a superkey.
•A superkey may contain extraneous attributes.
Eg: the combination of ID and name is a superkey
for the relation instructor.
A primary key is a key that is chosen by the database
designer as the principal means of identifying entities
within a relation.
Primary key attributes are underlined.
KEYS FOR RELATIONSHIP SETS

• Let R be a relationship set involving entity sets E1, E2, …, En.


• Let primary-key(Ei ) denote the set of attributes that forms the primary key for entity
set Ei.
• If the relationship set R has no attributes associated with it, then an individual relation
in R is defined by
primary-key(E1) ∪ primary-key(E2) ∪ ⋯ ∪ primary-key(En)
• If the relationship set R has attributes a1, a2, …, am associated with it, then an
individual relation in R is defined by
primary-key(E1) ∪ primary-key(E2) ∪ ⋯ ∪ primary-key(En) ∪ {a1, a2, …, am}
WEAK ENTITY SETS
• A weak entity set is one whose existence is dependent on another entity set,
called its identifying entity set.
• An entity set that is not a weak entity set is termed a strong entity set.
• 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.
• The primary key of the identifying entity, along with extra attributes,
called discriminator attributes uniquely identify a weak entity.
• In E-R diagrams, a weak entity set is depicted via a double rectangle
• The discriminator is underlined with a dashed line.
• The relationship set connecting the weak entity set to the identifying strong entity set is
depicted by a double diamond.
EXTENDED FEATURES OF E-R MODEL

1. Specialization
2. Generalization
3. Aggregation
SPECIALIZATION
• The process of designating subgroupings within an entity set is called
specialization.
Example: The entity set person may be further classified as one of the
following:
• employee
• student

• In E-R diagram, specialization is depicted by a hollow arrow-head


pointing from the specialized entity to the other entity.
• This relationship is called ISA relationship, which stands for “is a”.
Higher-level entity sets are called Superclass.

Lower-level entity sets are called subclass.


CONSTRAINTS ON SPECIALIZATIONS
Disjointness Constrain:
1. Overlapping Specialization:
The entity belong to a multiple specialized entity set.
Two separate arrows are used.

2. Disjoint Specialization:
The entity belong to at most one specialized entity set.
A single arrow is used.
Completeness Constrain

1. Total
Specialization : Every entity that belongs to a superclass
must belong to at least one subclass of the specialization.
2. Partial specialization: Some entities might not belong to any
of the subclasses of the specialization
Partial specialization is the default.
Total specialization is represented by adding the keyword “total” in the
diagram.
The completeness and disjointness constraints, do not
depend on each other.

So , specializations may be:


1. partial-overlapping
2. partial-disjoint
3. total-overlapping
4. total-disjoint
GENERALIZATION

• Generalization is a simple inversion of specialization.


• It is a bottom-up design process.
AGGREGATION
STRUCTURE OF RELATIONAL DATABASE
• A relational database consists of a collection of tables, each of which is assigned a
unique name.
REDUCING E-R DIAGRAM TO RELATIONAL SCHEMAS
1. Representation of Strong Entity Sets
For schemas derived from strong entity sets, the primary key of the entity set serves as the
primary key of the resulting schema.
2. Representation of Strong Entity Sets with Complex Attributes
Composite attributes are modelled by creating a separate attribute for each of the
component attributes.
3. Multivalued Attribute
Derived attributes are not represented on a Relational
Schema
4. Representation of Weak Entity Sets
REPRESENTATION OF RELATIONSHIP SETS

Consider the relationship set advisor which involves the following entity sets:
1. instructor, with the primary key ID.
2. student, with the primary key ID.

Since both attributes have the same name, we rename them i ID and s ID.
Since the advisor relationship set is many-to-one from student to instructor the primary
key for the advisor relation schema is s ID.
advisor (s ID, i ID)
REPRESENTATION OF SPECIALIZATION & GENERALIZATION
• Create a schema for the higher-level entity set.

• For each lower-level entity set, create a schema that includes its
attributes and the primary key of the higher-level entity set.
REPRESENTATION OF AGGREGATION

You might also like