0% found this document useful (0 votes)
20 views64 pages

UNIT-1 - Part-II Updated Introduction To DBMS - CSE3001

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)
20 views64 pages

UNIT-1 - Part-II Updated Introduction To DBMS - CSE3001

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/ 64

VIT University

School of Computer Science


Engineering
Chapter 1 Part-II
Introduction to Databases
By
Sandeep Sahu
Contents

• Data Models and ER Models


Introduction to Data Models

• Data Model gives us an idea that how the final system will look like
after its complete implementation.
• It defines the data elements and the relationships between the data
elements. Data Models are used to show how data is stored,
connected, accessed and updated in the database management
system.
• Here, we use a set of symbols and text to represent the information
so that members of the organization can communicate and
understand it.
• Though there are many data models being used nowadays but the
Relational model is the most widely used model.
Types of Data Models
1. Hierarchical Model
2. Network Model
3. Entity-Relationship Model
4. Relational Model
5. Object-Oriented Data Model
6. Object-Relational Data Model
7. Flat Data Model
8. Semi-Structured Data Model
9. Associative Data Model
10.Context Data Model
Hierarchical Model
• Hierarchical Model was the first DBMS model.
• This model organizes the data in the hierarchical tree
structure.
• The hierarchy starts from the root which has root data
and then it expands in the form of a tree adding child
node to the parent node.
• Example: We can represent the relationship between
the shoes present on a shopping website in the
following way:
Example
Features of a Hierarchical
Model
1. One-to-many relationship: The data here is organized in a tree-like
structure where the one-to-many relationship is between the
datatypes. Also, there can be only one path from parent to any node.
2. Parent-Child Relationship: Each child node has a parent node but a
parent node can have more than one child node. Multiple parents are
not allowed.
3. Deletion Problem: If a parent node is deleted then the child node is
automatically deleted.
4. Pointers: Pointers are used to link the parent node with the child
node and are used to navigate between the stored data.
Advantages of Hierarchical
Model
• It is very simple and fast to traverse through a
tree-like structure.
• Any change in the parent node is automatically
reflected in the child node so, the integrity of
data is maintained.
Disadvantages of
Hierarchical Model
• Complex relationships are not supported.
• As it does not support more than one parent of the
child node so if we have some complex relationship
where a child node needs to have two parent node
then that can't be represented using this model.
• If a parent node is deleted then the child node is
automatically deleted.
Network Model
• This model is an extension of the hierarchical
model. It was the most popular model before the
relational model.
• This model is the same as the hierarchical model,
the only difference is that a record can have more
than one parent.
• It replaces the hierarchical tree with a graph.
Example
• In the example below we can see that node student has two
parents i.e. CSE Department and Library.
• This was earlier not possible in the hierarchical model.
Features of a Network
Model
1. Ability to Merge more Relationships: In this model, as there are more
relationships so data is more related. This model has the ability to manage
one-to-one relationships as well as many-to-many relationships.
2. Many paths: As there are more relationships so there can be more than
one path to the same record. This makes data access fast and simple.
3. Circular Linked List: The operations on the network model are done with
the help of the circular linked list. The current position is maintained with
the help of a program and this position navigates through the records
according to the relationship.
Advantages of Network
Model
• The data can be accessed faster as compared to the
hierarchical model.
• This is because the data is more related in the network
model and there can be more than one path to reach a
particular node.
• So the data can be accessed in many ways.
• As there is a parent-child relationship so data integrity is
present.
• Any change in parent record is reflected in the child
record.
Disadvantages of Network
Model
• As more and more relationships need to be
handled the system might get complex.
• So, a user must be having detailed knowledge of
the model to work with the model.
• Any change like updation, deletion, insertion is
very complex.
Entity-Relationship Model

• Entity-Relationship Model or simply ER Model is a


high-level data model diagram.
• In this model, we represent the real-world problem
in the pictorial form to make it easy for the
stakeholders to understand.
• It is also very easy for the developers to understand
the system by just looking at the ER diagram.
Components of E_R Model
• Entities: Entity is a real-world thing. It can be a person,
place, or even a concept. Example: Teachers, Students,
Course, Building, Department, etc are some of the entities
of a School Management System.
• Attributes: An entity contains a real-world property called
attribute. This is the characteristics of that
attribute. Example: The entity teacher has the property
like teacher id, salary, age, etc.
• Relationship: Relationship tells how two attributes or
data objects are related. Example: Teacher works for a
department.
Example

In the above diagram, the entities are Teacher and Department. The attributes
of Teacher entity are Teacher_Name, Teacher_id, Age, Salary, Mobile_Number. The
attributes of entity Department entity are Dept_id, Dept_name. The two entities are
connected using the relationship. Here, each teacher works for a department.
Features of ER Model

• Graphical Representation for Better Understanding: It


is very easy and simple to understand so it can be used by
the developers to communicate with the stakeholders.
• ER Diagram: ER diagram is used as a visual tool for
representing the model.
• Database Design: This model helps the database
designers to build the database and is widely used in
database design.
Advantages of ER Model

• Simple: Conceptually ER Model is very easy to build. If we know


the relationship between the attributes and the entities we can
easily build the ER Diagram for the model.
• Effective Communication Tool: This model is used widely by the
database designers for communicating their ideas.
• Easy Conversion to any Model: This model maps well to the
relational model and can be easily converted relational model by
converting the ER model to the table. This model can also be
converted to any other model like network model, hierarchical
model etc.
Disadvantages of ER Model

• No industry standard for notation: There is no


industry standard for developing an ER model.
So one developer might use notations which are
not understood by other developers.
• Hidden information: Some information might
be lost or hidden in the ER model. As it is a high-
level view so there are chances that some details
of information might be hidden.
Relational Model
• Relational Model is the most widely used model. In
this model, the data is maintained in the form of a
two-dimensional table.
• All the information is stored in the form of row and
columns.
• The basic structure of a relational model is tables.
• So, the tables are also called relations in the relational
model.
Example
In this example, we have an Employee table.
Features of Relational Model

• Tuples: Each row in the table is called tuple. A row contains all
the information about any instance of the object. In the above
example, each row has all the information about any specific
individual like the first row has information about John.
• Attribute or field: Attributes are the property which defines the
table or relation. The values of the attribute should be from the
same domain. In the above example, we have different attributes
of the employee like Salary, Mobile_no, etc.
Advantages of Relational
Model
• Simple: This model is more simple as compared to the
network and hierarchical model.
• Scalable: This model can be easily scaled as we can add as
many rows and columns we want.
• Structural Independence: We can make changes in
database structure without changing the way to access the
data. When we can make changes to the database
structure without affecting the capability to DBMS to
access the data we can say that structural independence
has been achieved.
Disadvantages of Relational
Model
• Hardware Overheads: For hiding the complexities and
making things easier for the user this model requires more
powerful hardware computers and data storage devices.
• Bad Design: As the relational model is very easy to design
and use. So the users don't need to know how the data is
stored in order to access it. This ease of design can lead to the
development of a poor database which would slow down if
the database grows.
Object-Oriented Data Model
• The real-world problems are more closely represented
through the object-oriented data model.
• In this model, both the data and relationship are present
in a single structure known as an object.
• We can store audio, video, images, etc in the database
which was not possible in the relational model(although
you can store audio and video in relational database, it is
advised not to store in the relational database).
• In this model, two are more objects are connected through
links. We use this link to relate one object to other objects.
Example

In the above example, we have two objects Employee and Department. All the data
and relationships of each object are contained as a single unit. The attributes like
Name, Job_title of the employee and the methods which will be performed by that
object are stored as a single object. The two objects are connected through a
common attribute i.e the Department_id and the communication between these two
will be done with the help of this common id.
Object-Relational Model
• As the name suggests it is a combination of both the
relational model and the object-oriented model. This
model was built to fill the gap between object-oriented
model and the relational model. We can have many
advanced features like we can make complex data types
according to our requirements using the existing data
types. The problem with this model is that this can get
complex and difficult to handle. So, proper understanding
of this model is required.
Flat Data Model

• It is a simple model in which the database is


represented as a table consisting of rows and
columns. To access any data, the computer has
to read the entire table. This makes the modes
slow and inefficient.
Semi-Structured Model
• Semi-structured model is an evolved form of the relational
model. We cannot differentiate between data and schema
in this model. Example: Web-Based data sources which
we can't differentiate between the schema and data of the
website. In this model, some entities may have missing
attributes while others may have an extra attribute. This
model gives flexibility in storing the data. It also gives
flexibility to the attributes. Example: If we are storing any
value in any attribute then that value can be either atomic
value or a collection of values.
Associative Data Model
• Associative Data Model is a model in which the data is
divided into two parts. Everything which has independent
existence is called as an entity and the relationship among
these entities are called association. The data divided into
two parts are called items and links.
• Item: Items contain the name and the identifier(some
numeric value).
• Links: Links contain the identifier, source, verb and
subject.
Example

• Let us say we have a statement "The world cup is being hosted


by London from 30 May 2020". In this data two links need to be
stored.
1. The world cup is being hosted by London. The source here is
'the world cup', the verb 'is being' and the target is 'London'.
2. ...from 30 May 2020. The source here is the previous link, the
verb is 'from' and the target is '30 May 2020'.
Example Cont.…

This is represented using the table as follows:


Context Data Model

• Context Data Model is a collection of several


models. This consists of models like network
model, relational models etc. Using this model
we can do various types of tasks which are not
possible using any model alone.
How to draw ER-Diagram
Introduction to ER Model

• The ER model defines the conceptual view of a database. It works


around real-world entities and the associations among them. At view
level, the ER model is considered a good option for designing
databases.
• Entity
• An entity can be a real-world object, either animate or inanimate, that
can be easily identifiable. For example, in a school database,
students, teachers
• Attributes
• Entities are represented by means of their properties,
called attributes. All attributes have values. For example, a student
entity may have name, class, and age as attributes.
Types of Attributes

• Simple attribute − Simple attributes are atomic values, which


cannot be divided further. For example, a student's phone number is
an atomic value of 10 digits.
• 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.
• 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. For another example, age can be
derived from data_of_birth.
Types of Attribute Cont..

• Single-value attribute − Single-value attributes


contain single value. For example −
Social_Security_Number.
• 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
ER Design Issues
• In the previous sections of the data modeling, we learned to design an
ER diagram.
• We also discussed different ways of defining entity sets and relationships
among them.
• We also understood the various designing shapes that represent a
relationship, an entity, and its attributes.
• However, users often mislead the concept of the elements and the
design process of the ER diagram.
• Thus, it leads to a complex structure of the ER diagram and certain
issues that does not meet the characteristics of the real-world enterprise
model.
1) Use of Entity Set vs Attributes
The use of an entity set or attribute depends on the structure of the real-
world enterprise that is being modelled and the semantics associated with
its attributes.
It leads to a mistake when the user use the primary key of an entity set as
an attribute of another entity set. Instead, he should use the relationship to
do so.
Also, the primary key attributes are implicit in the relationship set, but we
designate it in the relationship sets.
2) Use of Entity Set vs. Relationship Sets
It is difficult to examine if an object can be best expressed by an entity
set or relationship set.
To understand and determine the right use, the user need to designate a
relationship set for describing an action that occurs in-between the entities.
If there is a requirement of representing the object as a relationship set,
then its better not to mix it with the entity set.
3) Use of Binary vs n-ary Relationship Sets
Generally, the relationships described in the databases are binary
relationships.
However, non-binary relationships can be represented by several binary
relationships.
For example, we can create and represent a ternary relationship 'parent' that
may relate to a child, his father, as well as his mother.
Such relationship can also be represented by two binary relationships i.e,
mother and father, that may relate to their child.
Thus, it is possible to represent a non-binary relationship by a set of distinct
binary relationships.
4) Placing Relationship Attributes
The cardinality ratios can become an affective measure in the placement of
the relationship attributes.
So, it is better to associate the attributes of one-to-one or one-to-many
relationship sets with any participating entity sets, instead of any relationship
set.
The decision of placing the specified attribute as a relationship or entity
attribute should possess the charactestics of the real world enterprise that is
being modelled.
Weak Entity Sets
• An entity type should have a key attribute which uniquely identifies each entity
in the entity set, but there exists some entity type for which key attribute can’t be
defined. These are called Weak Entity type.
• The entity sets which do not have sufficient attributes to form a primary
key are known as weak entity sets and the entity sets which have a primary key
are known as strong entity sets.
• As the weak entities do not have any primary key, they cannot be identified on
their own, so they depend on some other entity (known as owner entity). The
weak entities have total participation constraint (existence dependency) in its
identifying relationship with owner identity.
• Weak entity types have partial keys. Partial Keys are set of attributes with the
help of which the tuples of the weak entities can be distinguished and
identified.
• Note – Weak entity always has total participation but Strong entity may not have total participation.
Domain constraints in DBMS

• In DBMS, constraints are the set of rules that ensures that when
an authorized user modifies the database they do not disturb the
data consistency and the constraints are specified within the DDL
commands like “alter” and “create” command.
• There are several types of constraints available in DBMS and they
are:
• Domain constraints
• Entity Integrity constraints
• Referential Integrity constraints
• Key constraints
Domain Constraints are user-defined columns that help the user to enter
the value according to the data type.
And if it encounters a wrong input it gives the message to the user that
the column is not fulfilled properly.
Or in other words, it is an attribute that specifies all the possible values
that the attribute can hold like integer, character, date, time, string, etc.
It defines the domain or the set of values for an attribute and ensures that
the value taken by the attribute must be an atomic value(Can’t be divided)
from its domain.
Type of domain constraints:
Domain Constraints – Not Null: Null values are the values that are
unassigned or we can also say that which are unknown or the missing
attribute values and by default, a column can hold the null values.
Domain Constraints – Check: It defines a condition that each row must
satisfy which means it restricts the value of a column between ranges or we
can say that it is just like a condition or filter checking before saving data
into a column.
DBMS Architecture

• The DBMS design depends upon its architecture.


• The basic client/server architecture is used to deal with a
large number of PCs, web servers, database servers and
other components that are connected with networks.
• The client/server architecture consists of many PCs and a
workstation which are connected via the network.
• DBMS architecture depends upon how users are connected
to the database to get their request done
Types of DBMS Architecture
Database architecture can be seen as a single tier or multi-
tier. But logically, database architecture is of two types like: 2-
tier architecture and 3-tier architecture.
1-Tier Architecture
In this architecture, the database is directly available to the
user.
It means the user can directly sit on the DBMS and uses it.
Any changes done here will directly be done on the database
itself.
It doesn't provide a handy tool for end users.
The 1-Tier architecture is used for development of the local
application, where programmers can directly communicate
with the database for the quick response.
2-Tier Architecture
The 2-Tier architecture is same as basic
client-server.
In the two-tier architecture, applications
on the client end can directly communicate
with the database at the server side.
For this interaction, API's
like: ODBC, JDBC are used.
The user interfaces and application
programs are run on the client-side.
The server side is responsible to provide
the functionalities like: query processing
and transaction management.
To communicate with the DBMS, client-
side application establishes a connection
with the server side.
3-Tier Architecture
The 3-Tier architecture contains
another layer between the client and
server.
In this architecture, client can't directly
communicate with the server.
The application on the client-end
interacts with an application server which
further communicates with the database
system.
End user has no idea about the
existence of the database beyond the
application server.
The database also has no idea about any
other user beyond the application.
The 3-Tier architecture is used in case of
large web application.
Degrees of data abstraction

• Data abstraction is the idea that a database design begins with a high
level view and as it approaches implementation level, the level of detail
increases.
• The benefit to using levels of abstraction is the ability to work with
and integrate multiple views into a cohesive set.
• In 1970, the American National Standards Institute (ANSI) Standards
Planning and Requirements Committee (SPARC) established a
framework for database design based on the degrees of abstraction.
• The ANSI/SPARC architecture is composed of four levels of data
abstraction; these levels are external, conceptual, internal, and physical.
Summary
• Presentation are designed specially for the beginners or
learners of Database System, its help students to defines
various Data models and their uses in application with
examples.
• Presentation are designed to the Introduction to ER MODEL, Types
of Attribute, Entity Sets, Composite Attributes, Mapping Cardinalities,
ER diagram, Entity with Composite, Derived and Multi value
Attributes, ER Relationship 1-1, 1-M, M-1 and M-M.
Thank You!!!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy