0% found this document useful (0 votes)
2 views

Unit2 dbms

The document provides an overview of database design, focusing on data models, specifically the Entity-Relationship (ER) model, which describes the structure of a database through entities, relationships, and attributes. It outlines different types of data models, including object-based and record-based models, and explains key concepts such as entity sets, attributes, relationships, and cardinality. The document emphasizes the importance of the ER model in facilitating database design and its role in representing real-world objects and their interconnections.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Unit2 dbms

The document provides an overview of database design, focusing on data models, specifically the Entity-Relationship (ER) model, which describes the structure of a database through entities, relationships, and attributes. It outlines different types of data models, including object-based and record-based models, and explains key concepts such as entity sets, attributes, relationships, and cardinality. The document emphasizes the importance of the ER model in facilitating database design and its role in representing real-world objects and their interconnections.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 126

DATABASE MANAGEMENT

SYSTEM

BDA202

Unit-2
Database Design, ER-Diagram, and Unified Modeling Language
INTRODUCTION DATA MODEL
 The data model describes the structure of a database.
 It is a collection of conceptual tools for describing data, data
relationships and consistency constraints and various types of
data model.
 Types of data model:

 1. Object based logical model


 a. ER-model
 b. Functional model
 c. Object oriented model
 d. Semantic model

 2. Record based logical model


 a. Hierarchical database model
 b. Network model
 c. Relational model
 3. Physical model
ENTITY RELATIONSHIP MODEL
 The entity-relationship data model perceives the real world as
consisting of basic objects, called entities and relationships
among these objects.
 It was developed to facilitate data base design by allowing
specification of an enterprise schema which represents the
overall logical structure of a data base.

 Main features of ER-MODEL:


 Entity relationship model is a high level conceptual model
 It allows us to describe the data involved in a real world
enterprise in terms of objects and their relationships.
 It is widely used to develop an initial design of a database
 It provides a set of useful concepts that make it convenient for a
developer to move from a baseid set of information to a detailed
and description of information that can be easily implemented in
a database system
 It describes data as a collection of entities, relationships and
attributes.
NOTATIONS USED IN ER MODEL
BASIC CONCEPTS
 The E-R data model employs three basic notions : entity sets,
relationship sets and attributes.

 Entity sets:
 An entity is a “thing” or “object” in the real world that is
distinguishable from all other objects.
 For example, each person in an enterprise is an entity. An
entity has a set properties and the values for some set of
properties may uniquely identify an entity.
 BOOK is entity and its properties(calles as attributes)
bookcode, booktitle, price etc .
 An entity set is a set of entities of the same type that share
the same properties, or attributes.
 The set of all persons who are customers at a given bank, for
example, can be defined as the entity set customer.
ATTRIBUTES:
 An entity is represented by a set of attributes.
 Attributes are descriptive properties possessed by each
member of an entity set.
 Customer is an entity and its attributes are customerid,
custmername, custaddress etc.
 An attribute as used in the E-R model , can be characterized
by the following attribute types.

 a) Simple and composite attribute:


 simple attributes are the attributes which can’t be divided into
sub parts eg: customerid,empno
 composite attributes are the attributes which can be divided
into subparts.
 eg: name consisting of first name, middle name, last name
 address consisting of city, pincode, state
CONTD…
 b) single-valued and multi-valued attribute:
 The attribute having unique value is single –valued attribute,
e.g.
 empno ,customerid, regdno etc.
 The attribute having more than one value is multi-valued
attribute
 eg: phone-no, dependent name, vehicle

 c) Derived Attribute:
 The values for this type of attribute can be derived from the
values of existing attributes, e.g.
 age which can be derived from (currentdate-birthdate)
 experience_in_year can be calculated as (currentdate-joindate)

 d) NULL valued attribute:


 The attribute value which is unknown to user is called NULL
valued attribute.
RELATIONSHIPS
 Associations between entities are called relationships
 Example : An employee works for an organization. Here "works for" is a relation between the
entities employee and organization.
 However in ER Modeling, To connect a weak Entity with others, you should use a weak
relationship notation.

 Degree of a Relationship
 Degree of a relationship is the number of entity types involved.
 The n-ary relationship is the general form for degree n.
 Special cases are unary, binary, and ternary ,where the degree is 1, 2, and 3, respectively.
 Example for unary relationship : An employee is a manager of another employee
 Example for binary relationship : An employee works-for department.
 Example for ternary relationship : customer purchase item from a shop keeper
 Cardinality of a Relationship
 Relationship cardinalities specify how many of each entity type is allowed. Relationships can have
four possible
 connectivities as given below.
 1. One to one (1:1) relationship
 2. One to many (1:N) relationship
 3. Many to one (M:1) relationship
 4. Many to many (M:N) relationship
 The minimum and maximum values of this connectivity is called the cardinality of the
relationship
 Example for Cardinality – One-to-One (1:1)
 Employee is assigned with a parking space.
RELATIONSHIP
 A relationship is an association among several entities.
 A relationship set is a set of relationships of the same type.
 Formally, it is a mathematical relation on n>=2 entity sets.
 If E1,E2…En are entity sets, then a relation ship set R is a
subset of
 {(e1,e2,…en)|e1 Є E1, e2 Є E2.., en Є En} where (e1,e2,…en)
is a relation ship.
 Consider the two entity sets customer and loan. We define the
relationship set borrow to denote the association between
customers and the bank loans that the customers have.
MAPPING CARDINALITIES
 Mapping cardinalities or cardinality ratios, express the number
of entities to which another entity can be associated via a
relationship set.
 Mapping cardinalities are most useful in describing binary
relationship sets, although they can contribute to the
description of relationship sets that involve more than two
entity sets.
 For a binary relationship set R between entity sets A and B, the
mapping cardinalities must be one of the following:
 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.
 e.g.: relationship between college and principal
CONTD…
 One to many:
 An entity in A is associated with any number of entities in B.
An entity in B is associated with at the most one entity in A.
 e.g.: Relationship between department and faculty

 Many to one:
 An entity in A is associated with at most one entity in B. An
entity in B is associated with any number in A.
CONTD…
 Many-to-Many (M:N):
 Students enrolls for courses. One student can enroll for many
courses and one course can be enrolled by many students.
 Hence it is a M:N relationship and cardinality is Many-to-Many
(M:N)
RELATIONSHIP PARTICIPATION
1. Total : In total participation, every entity instance will be
connected through the relationship to another instance of the
other participating entity types

2. Partial : Consider the relationship - Employee is head of the


department.
Here all employees will not be the head of the department.
Only one employee will be the head of the department.
In other words, only few instances of employee entity
participate in the above relationship.
So employee entity's participation is partial in the said
relationship.

However each department will be headed by some employee.


So department entity's participation is total in the said
relationship.
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
DATA MODELS
 Underlying the structure of a database is the data model: a
collection of conceptual tools for describing data, data
relationships, data semantics, and consistency constraints.
 A data model provides a way to describe the design of a
database at the physical, logical, and view levels.

 The data models can be classified into four different


categories:

 Relational Model ( Already discussed earlier)

 The relational model uses a collection of tables to represent


both data and the relationships among those data.
 Each table has multiple columns, and each column has a
unique name. Tables are also known as relations.
 The relational model is an example of a record-based model.
SAMPLE RELATIONAL DATABASE
RDBMS
 RDBMS: the relational database management system
(RDBMS)
 Relation: a relation is a 2D table has the following features:
 Name
 Attributes
 Tuples
CONTD…
 Record-based models are so named because the database is
structured in fixed-format records of several types.
 Each table contains records of a particular type. Each record
type defines a fixed number of fields, or attributes.
 The columns of the table correspond to the attributes of the
record type.
 The relational data model is the most widely used data model,
and a vast majority of current database systems are based on
the relational model.
ENTITY-RELATIONSHIP MODEL
 The entity-relationship (E-R) data model uses a collection of
basic objects, called entities, and relationships among these
objects.
 An entity is a “thing” or “object” in the real world that is
distinguishable from other objects. The entity- relationship
model is widely used in database design.
 Rectangles represent entity sets.
 Diamonds represent relationship sets.
 Lines link attributes to entity sets and entity sets to
relationship sets.
 Ellipses represent attributes
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RE
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA
RELATIONAL ALGEBRA

You might also like