0% found this document useful (0 votes)
19 views22 pages

Dbms 1

The document provides an overview of Database Management Systems (DBMS), including concepts such as data, databases, and data models. It discusses the characteristics and advantages of DBMS, transaction processing properties, types of data, and different user roles. Additionally, it covers data models, schemas, and the architecture of databases.

Uploaded by

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

Dbms 1

The document provides an overview of Database Management Systems (DBMS), including concepts such as data, databases, and data models. It discusses the characteristics and advantages of DBMS, transaction processing properties, types of data, and different user roles. Additionally, it covers data models, schemas, and the architecture of databases.

Uploaded by

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

2 3

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Syllabus Data, Database & DBMS


• Introduction & Entity Relationship (ER) • Data
Model ▫ Known facts that can be recorded and have
▫ Concept & Overview of Database Management implicit meaning
Systems (DBMS). Characteristics of Database system, • Database
▫ Database Users, structured, semi-structured and
unstructured data. Data Models and Schema - Three
▫ The collection of data
Schema architecture. Database Languages, Database • Database-management system (DBMS)
architectures and classification. ▫ is a collection of interrelated data and a set of
▫ ER model - Basic concepts, entity set & attributes, programs to access those data.
notations, Relationships and constraints, ▫ General purpose software system that facilitates
▫ cardinality, participation, notations, weak entities, process of defining, constructing, manipulating,
relationships of degree 3. and sharing database
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

4 5

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

• Database systems are designed to manage large


The primary goal of a DBMS is to provide a way to bodies of information.
store and retrieve database information that is • Management of data involves both storage of
both convenient and efficient. information and mechanisms for manipulation
of information.
• The database system must ensure the safety of
the information stored
• If data are to be shared among several users, the
system must avoid possible anomalous results.
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

6 7

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Database implicit properties


• Universe of discourse(UoD) or Miniworld DBMS is a general purpose software system that
▫ Database represent some aspects of real world facilitates process of defining, constructing,
▫ Changes to miniworld affects database manipulating, and sharing database
• A database is a logically coherent collection of
data with some inherent meaning
• A database is designed, built and populated with
data for specific purpose

Downloaded from Ktunotes.in Downloaded from Ktunotes.in


8 9

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Characteristics of the Database


Database System Environment
Approach
1. Self describing nature of a database system
2. Insulation between programs and data, and
data abstraction
3. Support of multiple views of the data

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

10 11

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Self-Describing Nature of a Database


Insulation between Programs and
System
Data, and Data Abstraction
• database system contains not only the database • The structure of data files is stored in the DBMS catalog
separately from the access programs.
itself but also a complete definition or • This property is called program-data independence
description of the database structure and • An operation (also called a function or method) is
specified in two parts.
constraints. • Interface
• This definition is stored in the DBMS catalog ▫ The interface (or signature) of an operation includes
• information stored in the catalog is called meta- the operation name and the data types of its
arguments (or parameters).
data and it describes the structure of the primary • Implementation
database. ▫ The implementation (or method) of the operation is
specified separately and can be changed without
affecting the interface.
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

12 13

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Support of Multiple Views of the Data


• The characteristic that allows program-data • A database has many users, each user may
independence and program operation require a different perspective or view of the
independence is called data abstraction. database.
• A view may be a subset of the database or it may
contain virtual data that is derived from the
database files but is not explicitly stored.

Downloaded from Ktunotes.in Downloaded from Ktunotes.in


14 15

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Sharing of Data and Multiuser


Isolation Property
Transaction Processing
• DBMS must include concurrency control • ensures that each transaction appears to execute in
software isolation from other transactions
▫ to ensure that several users trying to update the • even though hundreds of transactions may be executing
concurrently.
same data do so in a controlled manner so that the
result of the updates is correct
• DBMS must enforce several transaction
properties
▫ Isolation property
▫ Atomicity property

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

16 17

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Atomicity Property Concurrent access Problems


• ensures that either all the database operations in a transaction
are executed or none are. • Many systems allows multiple users to update
• Any mechanical or electrical device is subject to failure, and so the data simultaneously.
is the computer system.
• In this case we have to ensure that data should be restored to • It can also lead the data in an inconsistent state.
a consistent state. • Suppose a bank account contains a balance of Rs
• For example an amount of Rs 50 has to be transferred from
Account A to Account B. 500 & two customers want to withdraw Rs100 &
• Let the amount has been debited from account A but have not Rs 50 simultaneously.
been credited to Account B and in the meantime, some failure
occurred. • Both the transaction reads the old balance &
▫ So, it will lead to an inconsistent state. withdraw from that old balance which will result
▫ So, we have to adopt a mechanism which ensures that either full
transaction should be executed or no transaction should be in Rs 450 , Rs 400 which is incorrect.
executed i.e. the fund transfer should be atomic.
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

18 19

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Security Problems Advantages of DBMS


• All the user of database should not be able to • Controlling Redundancy
access all the data. • Restricting Unauthorized Access
• For example a payroll Personnel needs to access • Providing Storage Structures for Efficient
only that part of data which has information • Query Processing
about various employees & are not needed to • Providing Backup and Recovery
access information about customer accounts. • Providing Multiple User Interfaces
• Representing Complex Relationship among Data
• Enforcing Integrity Constraints
• Permitting Inferencing and Actions using Rules
Downloaded from Ktunotes.in Downloaded from Ktunotes.in
20 21

PREPARED BY PREPARED BY

DBMS Structure
SHARIKA T R SHARIKA T R

Disadvantages of DBMS
• Cost of Hardware & Software
• Cost of Data Conversion
• Cost of Staff Training
• Appointing Technical Staff
• Database Damage

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

22 23

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Database Users and Administrators Different types of users


• A primary goal of a database system is to retrieve • Na¨ıve users
information from and store new information in • Application programmers
the database. • Sophisticated users
• People who work with a database can be
categorized as database users or database
administrators.

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

24 25

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

1. Naïve Users 2. Application programmers


• unsophisticated users who interact with the • Are computer professionals who write
system by using predefined user interfaces, application programs
such as web or mobile applications • they can choose from many tools to develop
• typical user interface is a forms interface, user interfaces
where the user can fill in appropriate fields of
the form
• may also view read reports generated from
the database.

Downloaded from Ktunotes.in Downloaded from Ktunotes.in


26 27

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

3. Sophisticated users Database Administrator


• interact with the system without writing • A person who has such central control over the
programs. system is called a database administrator (DBA).
• The functions of a DBA include:
• Instead they form their requests either using ▫ Schema definition.
a database query language or by using tools  The DBA creates the original database schema by
such as data analysis software. executing a set of data definition statements in the
DDL.
• Analysts who submit queries to explore data
▫ Storage structure and access-method definition.
in the database fall in this category  The DBA may specify some parameters pertaining to
the physical organization of the data and the indices
to be created.
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

28 29

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

ACTORS ON THE SCENE


▫ Schema and physical-organization modification • The people whose jobs involve the day-to-day
 The DBA carries out changes to the schema and use of a large database are called as the actors on
physical organization to reflect the changing needs
of the organization the scene.
 or to alter the physical organization to improve 1. Database Administrators
performance 2. Database Designers
▫ Granting of authorization for data access. 3. End Users
 The authorization information is kept in a special
system structure that the database system consults
4. System Analyst and Application
whenever a user tries to access the data in the Programmers(Software engineers)
system.

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

30 31

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Structured, Semi-structured and


WORKERS BEHIND THE SCENE
Unstructured data
• The people who work to maintain the database
system environment but who are not actively
interested in the database contents as part of
their daily job are called as the workers behind
the scene
1. DBMS system designers and implementers
2. Tool developers
3. Operators and maintenance personnel (system
administration personnel)
Downloaded from Ktunotes.in Downloaded from Ktunotes.in
32 33

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Structured data Semi-Structured data


• Represented in a strict format • information that does not reside in a relational
• It has been organized into a formatted repository database but that have some organizational
that is typically a database. properties that make it easier to analyze
• It concerns all data which can be stored in • With some process, you can store them in the
database SQL in a table with rows and columns relation database
• . Example: Relational data • but Semi-structured exist to ease space.
• Example: XML data

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

34 35

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Unstructured data
• data which is not organized in a predefined manner
or does not have a predefined data model,
• thus it is not a good fit for a mainstream relational
database
• there are alternative platforms for storing and
managing, it is increasingly prevalent in IT systems
and is used by organizations in a variety of business
intelligence and analytics applications.
• Example: Word, PDF, Text, Media logs.

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

36 37

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Data Models Categories of Data Models


• a collection of concepts that can be used to • High-level or conceptual data models
describe the structure of a database • Low-level or physical data models
• structure of a database we mean the data types, • Representational (or implementation) data
relationships, and constraints that should hold models
on the data.
• Most data models also include a set of basic
operations for specifying retrievals and
updates on the database.

Downloaded from Ktunotes.in Downloaded from Ktunotes.in


38 39

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

High-level or conceptual data models Low-level or physical data models


• provide concepts that are close to the way • Provide concepts that describe the details of how
many users perceive data data is stored in the computer.
• use concepts such as entities, attributes, and • Concepts provided by low-level data models are
relationships generally meant for computer specialists, not for
• An entity represents a real-world object or typical end users.
concept • Describe how data is stored in the computer by
representing information such as record
• An attribute represents some property of formats, record orderings, and access paths.
interest that further describes an entity, • An access path is a structure that makes the
• A relationship among two or more entities search for particular database records efficient.
represents an interaction among the entities
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

40 41

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Representational (or Schemas, Instances, and Database


implementation) data models State
• Which provide concepts that may be understood by • The description of a database is called the
end users but that are not too far removed from the database schema, which is specified during
way data is organized within the computer. database design and is not expected to change
• It hides some details of data storage but can be frequently
implemented on a computer system in a direct way. • A displayed schema is called a schema
• used most frequently in traditional commercial diagram. We call each object in the schema a
DBMSs, and they include the widely-used schema construct.
relational data model
• The data in database at particular instant or
• the network and hierarchical models
moment of time is called database state or
• sometimes called record-based data models
snapshot
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

42 43

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

• The schema is not supposed to change


frequently, but it is not uncommon that changes
occasionally need to be applied to the schema as
Database schema the application requirements change. It is called
schema evolution.
Name Student_number Class Major
Ram CS001 R4 CSE
Shyam CS002 R4 CSE

Database state

Downloaded from Ktunotes.in Downloaded from Ktunotes.in


44 45

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

The Three-Schema Architecture Internal level


• The internal level has an internal schema,
which describes the physical storage structure
of the database.
• The internal schema uses a physical data model
and describes the complete details of data
storage and access paths for the database.

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

46 47

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Conceptual level External or view level


• Describes the structure of the whole database for • The external or view level includes a number
a community of users. of external schemas or user views.
• The conceptual schema hides the details of • Each external schema describes the part of the
physical storage structures and concentrates on database that a particular user group is
describing entities, data types, relationships, interested in and hides the rest of the database
user operations, and constraints. from that user group.
• A high-level data model or an implementation • A high-level data model or an implementation
data model can be used at this level. data model can be used at this level.

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

48 49

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Mappings
• In a DBMS based on the three-schema architecture, • The processes of transforming requests and
each user group refers only to its own external results between levels are called mappings.
schema.
• Hence, the DBMS must transform a request • These mappings may be time-consuming, so
specified on an external schema into a request some DBMSs—especially those that are meant to
against the conceptual schema, and then into a support small databases—do not support
request on the internal schema for processing over external views.
the stored database.
• a certain amount of mapping is necessary to
• If the request is a database retrieval, the data
extracted from the stored database must be transform requests between the conceptual and
reformatted to match the user’s external view. internal levels.
Downloaded from Ktunotes.in Downloaded from Ktunotes.in
50 51

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Data Independence Logical data independence


• The capacity to change the schema at one level of • Logical data independence is the capacity to
a database system without having to change the change the conceptual schema without having
schema at the next higher level. to change external schemas or application
• Two types of data independence: programs.
1. Logical data independence
2. Physical data independence

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

52 53

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Database Languages and Interfaces


Physical data independence
DBMS Languages
• Physical data independence is the capacity to • Data definition language ( DDL ), is used by the
change the internal schema without having to DBA and by database designers to define conceptual
and internal schemas schemas.
change the conceptual schema.
• Storage definition language ( SDL ), is used to
• Data independence occurs because when the specify the internal schema.
schema is changed at some level, the schema • View definition language ( VDL ), to specify
at the next higher level remains unchanged; user views and their mappings to conceptual schema
only the mapping between the two levels is • Data Manipulation Language(DML) is used for
changed. retrieval, insertion, deletion, and modification of
the data
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

54 55

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

DBMS Interfaces
• There are two main types of DMLs. • User-friendly interfaces provided by a DBMS
• High-level or nonprocedural DML can be used
on its own to specify complex database operations may include the following:
concisely. 1. Menu-Based Interfaces for Web Clients or
• Low-level or procedural DML must be Browsing.
embedded in a general-purpose programming
language. This type of DML typically retrieves 2. Forms-Based Interfaces.
individual records or objects from the database and 3. Graphical User Interfaces (GUI)
processes each separately. Therefore, it needs to use
programming language constructs, such as looping, 4. Natural Language Interfaces
to retrieve and process each record from a set of 5. Speech Input and Output
records. Low-level DMLs are also called record-at-a-
time DMLs 6. Interfaces for Parametric Users.
Downloaded from Ktunotes.in Downloaded from Ktunotes.in
56 57

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

ER Diagram
• It is not a technical method
• High level conceptual data model
ER MODEL • It is used for conceptual data design of database
applications
• Collection of entities and their properties called
attributes and relationship between them
• Diagrammatic representation and easy to
understand for non technical users

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

58 59

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Entity Entity Type


• The basic object that the ER model represents • The entity type is a collection of the entity having
• A thing in real world with existence similar attributes.
• Entity is distinguished from other objects on • an entity type in an ER diagram is defined by a
basis of attributes name and a set of attributes
• Entities can be tangible and intangible • We use a rectangle to represent an entity type
in the E-R diagram, not entity.

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

60 61

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Entity set
• The collection of same type of entities that is
their attributes are same is called entity set
• We can say that entity type is a superset of the
entity set as all the entities are included in the
entity type

Downloaded from Ktunotes.in Downloaded from Ktunotes.in


62 63

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Attributes
• The properties of entity that basically describes it
• Attributes describes characteristics of entity
• Suppose we have a entity EMPLOYEE and its
attributes are ENO, ESAL, ENAME etc..
• Attributes have some set of allowed or permitted
values called Domain
• Attributes are represented by OVAL
• Each attribute of an entity set is associated with
domain that means the set of values that can be
assigned to that attribute for an entity
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

64 65

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Simple attribute vs Composite


Types of attribute
attribute
• Simple attribute vs Composite attribute • Simple attributes
• Single valued vs Multivalued attributes ▫ Attributes which are not divisible that is they
• Stored vs Derived attributes cannot be divided
▫ Eg: City, State, etc,.

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

66 67

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

• Composite Attribute
▫ Attributes that can be divided into smaller sub Single valued vs Multivalued Attributea
parts
▫ Example: Name attribute can be divided into • Single Valued
FirstName, MiddleName, LastName ▫ Attributes which are having single values
▫ Example: Age

Downloaded from Ktunotes.in Downloaded from Ktunotes.in


68 69

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

• Multi Valued Attributes


▫ Multi valued attributes are those attributes which Stored Vs Derived Attribute
can take more than one value for a given entity
from an entity set. • In some cases, two (or more) attribute values are
▫ Represented by double oval related ,for example, the Age and Birthdate
attributes of a person.
• For a particular person entity, the value of Age
can be determined from the current (today’s)
date and the value of that person’s birthdate.
• The Age attribute is hence called a derived
attribute and is said to be derivable from the
birthdate attribute, which is called a stored
attribute .
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

70 71

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Complex Attribute
• Complex attribute is a combination of composite
and multi-valued attributes.
• Complex attributes are represented by { } and
composite attributes are represented by ( ).
• Example: Address_phone attribute will hold
both the address and phone_no of any person.
• Example: {(2-A, St-5, Sec-4, Bhilai), 2398124}

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

72 73

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Null Valued Attributes Key attribute in an entity type


• Null value is a value which is not inserted but it • Key attributes will be having a unique value for
does not hold zero value. each entity of that attribute.
• The attributes which can have a null value called • It identifies every entity in the entity set.
null valued attributes. • Key attribute will never be a null valued
attribute.
• Example: Mobile_no attributes of a person may
• Any composite attribute can also be a key
not be having mobile phones. attribute.
• There could be more than one key attributes for
an entity type.
• Example: roll_no, enrollment _no
Downloaded from Ktunotes.in Downloaded from Ktunotes.in
74 75

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Domain of value set of an


Relationship
attribute
• Domain of an attribute is the allowed set of • Relates two or more distinct entities with a specific
• meaning.
values of that attribute.
• It is an association between two or more entities of
• Example: if attribute is ‘grade’, then its allowed same or different entity set
values are A,B,C,F. ▫ For example, EMPLOYEE John works on the
ProductX PROJECT or
• Grade ={A, B,C,F} ▫ EMPLOYEE Franklin manages the Research
DEPARTMENT.
• Terms used:
▫ Relationship type,
▫ Relationship set,
▫ Relationship instances.

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

76 77

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Relationship type Relationship Set


• A set of similar types of relationship • A relationship set is a set of relationships of
the same type.

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

78 79

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Downloaded from Ktunotes.in Downloaded from Ktunotes.in


80 81

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Graphical Representation of NOTATIONS USED IN E-R


Relationship Sets DIAGRAM
Key
Entity attribute

Derived
Weak Entity attribute

Attribute Multivalued
Attribute
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

82 83

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Composite Attribute
Constraints
• Relationship types usually have certain
constraints. Two main types of relationship
Relationship type constraints:
1. Mapping cardinalities
2. Participation constraints

Identifying Relationship

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

84 85

PREPARED BY PREPARED BY

• Binary Relationship
SHARIKA T R SHARIKA T R

Degree of a relationship
Employee Works Department
• It is the number of entity set which are in

participating in a relationship
▫ Unary relationship • Ternary Relationship
▫ Binary Relationship
Course
▫ Ternary Relationship

Teacher Teach Student

Downloaded from Ktunotes.in Downloaded from Ktunotes.in


86 87

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

• Unary Relationship • Each relationship has


▫ Name
▫ Degree
▫ Cardinality ratio
Student monitor

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

88 89

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Cardinality Ratio
• The cardinality ratio for a binary relationship • We express cardinality ratio by drawing
specifies the maximum number of relationship • directed line (→), signifying “one,” or an
instances to which an entity can take part in it
• undirected line (—), signifying “many,”
• It also specifies number of entities to which
other entity can be related by a relationship
• Types
▫ One-to-one (1:1)
▫ One-to-many (1: N)

▫ Many-to-one (N: 1)
▫ Many-to-many (M: N)
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

90 91

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

One to One(1:1) 1 1
Male married Female

• When only a single instance of an entity is


associated with single instance of other entity by
F1
a relationship M1
• When every entity of one entity set is related to M2 F2
maximum one entity of other entity set M3 F3

M4 F4

M5 F5

M6 F6
F7
Downloaded from Ktunotes.in Downloaded from Ktunotes.in
92 93

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

One to Many (1:M)


• When every entity of first entity set is related to
at most (max) n entities of other entity set then
it is one to many

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

94 95

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

1 M
Department has Employees

• In the one-to-many relationship a customer is


associated with several loans via borrower
d1 e1

d2 e2

d3 e3

d4 e4

d5 e5
e6
e7
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

96 97

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

1 M Many to One (M:1)


Manager manages Projects

• When many entities of first entity set is related


to 1 entity of other entity set then it is many to
p1
m1 one
m2 p2

m3 p3

m4 p4
p5
p6
p7
Downloaded from Ktunotes.in Downloaded from Ktunotes.in
98 99

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

M Works 1
Employee Department
for
• In a many-to-one relationship a loan is
e1 associated with several customers via borrower.
d1
e2
d2
e3
d3
e4
d4
e5
e6
e7
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

100 101

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Many to Many(M:N) M N
Teacher has Students

• When many occurrences of one entity is related


to many occurrences of another entity
s1
t1 s2
s3
t2 s4
s5
t3 s6
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

102 103

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Exercise
___ ___
Author writes Books

___ ___
Indian citizen has Pan card

___ ___
Indian citizen has Mobile number

Downloaded from Ktunotes.in Downloaded from Ktunotes.in


104 105

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Homework Participation constraints


• Prime minister-country • It specifies whether the existence of an entity
depends on being related to another entity through
• classroom –students relationship types
• students –classroom • These constraints defines max and min number of
relationship instance that each entity can participate
• customer -loan in
• Maximum cardinality
▫ It defines maximum number of times an entity can
participate in a relationship
• Minimum Cardinality
▫ It defines minimum number of times an entity can
participate in a relationship

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

106 107

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Total participation
• There are two types of participation constraints • every entity in the entity type participates in at
1. Total Participation least one relationship in the relationship type
▫ E.g. participation of loan in borrower is total every
2. Partial Participation
loan must have a customer associated to it via
borrower
• Represented by double lines
• Minimum and maximum cardinality
represented inside paranteses(m,n)

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

108 109

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

M (2,9)
Works 1 Partial participation
Employee Department
for
• Some entities may not participate in any
e1 relationship in the relationship type
d1 ▫ Example: participation of customer in borrower is
e2 partial
d2
e3 • Represented by single line
d3
e4
d4
e5
e6
e7
Downloaded from Ktunotes.in Downloaded from Ktunotes.in
110 111

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

TYPES OF ENTITY TYPES


• Strong entity type
▫ Entity types that have at least one key attribute.
▫ A strong entity is not dependent of any other
entity in the schema.
▫ A strong entity will always have a primary key.
▫ Strong entities are represented by a single
rectangle.
▫ The relationship of two strong entities is
represented by a single diamond.
▫ Various strong entities, when combined together,
create a strong entity set.
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

112 113

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

• Weak entity type


▫ Entity type that does not have any key attribute.
▫ A weak entity is dependent on a strong entity to
ensure the its existence.
▫ Unlike a strong entity, a weak entity does not have
any primary key.
▫ It instead has a partial discriminator key.
▫ A weak entity is represented by a double rectangle.
The relation between one strong and one weak
entity is represented by a double diamond.

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

114 115

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

• let us take an example of Professor entity,


which is our Strong Entity,
ith Professor_ID as a Primary Key

• The weak entity


is Professor_Dependents entity:

• Here Dependent is a weak entity and has no


primary key
• Professor has a primary key so is the strong
entity

Downloaded from Ktunotes.in Downloaded from Ktunotes.in


116 117

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Identifying Relationship
• It links the strong and weak entity and is
represented by a double diamond sign.
• Let us see with an example to link both the
entities using Identifying Relationships:

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

118 119

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Relationship of degree 3
• In Ternary relationship three different Entities takes
part in a Relationship.
• Relationship Degree = 3
• For Example: Consider a Mobile manufacture company.
Three different entities involved:
▫ Mobile - Manufactured by company.
▫ Part - Mobile Part which company get from Supplier.
▫ Supplier - Supplier supplies Mobile parts to Company.
• Mobile, Part and Supplier will participate simultaneously
in a relationship. because of this fact when we consider
cardinality we need to consider it in the context of two
entities simultaneously relative to third entity.
Downloaded from Ktunotes.in Downloaded from Ktunotes.in

120 121

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

Cardinality in Ternary Relationship


• Say for a given instance of Supplier and an • In case of Supplier’s cardinality we can say for a
Instance of Part, can that supplier supply that given instance of Mobile one of its Part can be
particular part for multiple Mobile models. supplied by multiple Suppliers.

Example − Consider a Supplier S1 that supplies Example − Consider a Mobile M1 that has a
a Processor P1 to the company and the uses the Part P1 and it is being supplied by multiple
Processor P1 supplied by Supplier S1 in its Suppliers in that case the cardinality of Supplier
multiple Models in that case the cardinality of relative to Mobile and Part is M (many).
Mobile relative to Supplier and Part is N (many).

Downloaded from Ktunotes.in Downloaded from Ktunotes.in


122 123

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

• Similarly, for a given instance of Supplier and an • Construct an E-R diagram for a car-insurance
instance for Mobile does the Supplier supply company whose customers own one or more cars
multiple Parts. each. Each car has associated with it zero to any
number of recorded accidents
Example − Consider a Supplier S1 supplying
parts for Mobile M1 like screen, Processor etc. in
that case the cardinality of Part relative to
Supplier and Mobile is P (many).

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

124 125

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

• Construct an E-R diagram for a hospital with a


set of patients and a set of medical doctors.
Associate with each patient a log of the various
tests and examinations conducted

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

126 127

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

A university registrar’s office maintains data about the


following entities: (a) courses, including number,
title, credits, syllabus, and prerequisites; (b) course
offerings, including course number, year, semester,
section number, instructor(s), timings, and
classroom; (c) students, including student-id, name,
and program; and (d) instructors, including
identification number, name, department, and title.
Further, the enrollment of students in courses and
grades awarded to students in each course they are
enrolled for must be appropriately modeled.
Construct an E-R diagram forthe registrar’s office.
Document all assumptions that you make about the
mapping constraints.
Downloaded from Ktunotes.in Downloaded from Ktunotes.in
128 129

PREPARED BY PREPARED BY
SHARIKA T R SHARIKA T R

• Consider a database used to record the marks


that students get in different exams of different
course offerings.
• Construct an E-R diagram that models exams as
entities, and uses a ternary relationship, for the
above database.

Downloaded from Ktunotes.in Downloaded from Ktunotes.in

130

PREPARED BY
SHARIKA T R

Downloaded from Ktunotes.in

You might also like