UNIT - 1 Introduction To DBMS
UNIT - 1 Introduction To DBMS
1.1 Introduction
A database management system (DBMS) is system software for creating and
managing databases. The DBMS provides users and programmers with a systematic way to
create, retrieve, update and manage data.
A DBMS makes it possible for end users to create, read, update and delete data in a database.
The DBMS essentially serves as an interface between the database and end users or application
programs, ensuring that data is consistently organized and remains easily accessible.
The DBMS manages three important things: the data, the database engine that allows data to be
accessed, locked and modified -- and the database schema, which defines the database’s logical
structure.
DBMS act as a interface or intermediate between Database and user. It allows the user or
application to interact with database in systematic way.
.
Database
Data Dictionary: data dictionary is a file or a set of files that contains a database's
metadata. The data dictionary contains records about other objects in the database, such as
data ownership, data relationships to other objects, and other data.
The data dictionary is a crucial component of any relational database. Ironically, because of its
importance, it is invisible to most database users. Typically, only database administrators
interact with the data dictionary.
Data Files: A data file is file which stores data to be used by a application or user .
DBMS Indexing: We know that data is stored in the form of records. Every record has a key
field, which helps it to be recognized uniquely. Indexing is a data structure technique to
efficiently retrieve records from the database files based on some attributes on which
the indexing has been done.
1. Physical Level: Physical level describes the physical storage structure of data in database,
as well it also describe how the data is stored and retrieve in database and also describe
compression and encryption techniques applied on data. It is also known as Internal Level.
This level is very close to physical storage of data. At lowest level, it is stored in the form of bits
with the physical addresses on the secondary storage device. At highest level, it can be viewed
2. Conceptual Level: Conceptual level also called logical or global level describes the structure of
the whole database for a group of users. It describe how the data will be appered to various user and
relationship between various data. Conceptual schema is a representation of the entire content of the
database. This schema contains all the information to build relevant external records. It hides the
internal details of physical storage.
3. External Level: External level is also called view level is related to the data which is viewed by
individual end users. This level includes a no. of user views or external schemas. This level is closest
to the user. External view describes the segment of the database that is required for a particular user
group and hides the rest of the database from that user group. The different user may have different
views.
1. Relational Data Model: Relational model is the most popular model and the most
extensively used model. In this model the data can be stored in the tables and this storing is
called as relation, the relations can be normalized and the normalized relation values are called
atomic values. Each row in a relation contains unique value and it is called as tuple, each
column contains value from same domain and it is called as attribute.
Structural independence – changes in the relational data structure do not affect the
DBMS’s data access in any way
Improved conceptual simplicity by concentrating on the logical view
Easier database design, implementation, management, and use
Powerful database management system.
Disadvantages
Can facilitate poor design and implementation
2. Network Data Model: Network model has the entities which are organized in a graphical
representation and some entities in the graph can be accessed through several paths. Its
distinguishing feature is that the schema, viewed as a graph in which object types are nodes
and relationship types are arcs, is not restricted to being a hierarchy or lattice. It can preserve
one to many or many to many relation.
Disadvantages
System complexity In a network model, data are accessed one record at a time.
Making structural modifications to the database is very difficult in the network database
3. Hierarchical Data Model: Hierarchical model has one parent entity with several children
entity but at the top we should have only one entity called root. For example, department is the
parent entity called root and it has several children entities like students, professors and many
more.
A hierarchical database model is a data model in which the data are organized into a tree-like
structure. The data are stored as records which are connected to one another through links. A
record is a collection of fields, with each field containing only one value. It preserves one to
many relations.
4. Object oriented Data Model: Object oriented data model is one of the developed data
model and this can hold the audio, video and graphic files. These consist of data piece and the
methods which are the DBMS instructions. OODBMS should be used when there is a business
need, high performance required, and complex data is being used. Due to the object oriented
nature of the database model, it is much simpler to approach a problem with these needs in
terms of objects.
Advantages:
Suitable for application expecting high performance.
Due to the object oriented nature of the database model, it is much simpler to approach a
problem
Disadvantages:
complex data is being used
Complex relations are used
5. Object relation Data Model: Object relation model is a very powerful model but coming
to its design it is quiet complex. This complexity is not problem because it gives efficient results
and widespread with huge applications. It has a feature which allows working with other
models like working with the very known relation model.
Advantages of Object Relational model is inheritance. The Object Relational data model allows
its users to inherit objects, tables etc. so that they can extend their functionality. An inherited
object contains new attributes as well as the attributes that were inherited.
The object relational data model can get quite complicated and difficult to handle at times as it
is a combination of the Object oriented data model and Relational data model and utilizes the
functionalities of both of them. This hybrid database model combines the simplicity of the
relational model with some of the advanced functionality of the object-oriented database
model. In essence, it allows designers to incorporate objects into the familiar table structure.
6. Entity Relationship Data Model: This model represents the data diagrammatically.
Entity relationship model is based on the notion of the real world entities and their
relationships. While formulating the real world scenario in to the database model an entity set
is created. This model captures the relationships between real-world entities much like the
network model, but it isn’t as directly tied to the physical structure of the database. Instead, it’s
often used for designing a database conceptually.
Here, the people, places, and things about which data points are stored are referred to as
entities, each of which has certain attributes that together make up their domain. The
cardinality, or relationships between entities, are mapped as well. and this model is dependent
on two vital things and they are 1. Entity and their attributes, 2. Relationships among entities.
7. Context Data Model: Context data model is a flexible model because it is a collection of
many data models. It is a collection of the data models like object oriented data model, network
model, semi structured model. So, in this different types of works can be done due to the
versatility of it. A context model defines how context data are structured and maintained It
plays a key role in supporting efficient context management.
8. Semi structured Data Model: Semi structured data model is a self-describing data
model, in this the information that is normally associated with a scheme is contained within the
data and this property is called as the self-describing property.
9. Associative Model: Associative model has a division property, this divides the real world
things about which data is to be recorded in two sorts i.e. between entities and associations.
Thus, this model does the division for dividing the real world data to the entities and
associations. The associative model of data is a data model for database systems. Other data
models, such as the relational model and the object data model, are record-based. These models
involve encompassing attributes about a thing, such as a car, in a record structure. Such
attributes might be registration, colour, make, model, etc. In the associative model, everything
which has “discrete independent existence” is model as an entity, and relationships between
them are modeled as associations.
10. Record base model: This model specify the overall strcture of database. Like Object based
model, they also describe data at the conceptual and view levels. These models specify logical
structure of database with records, fields and attributes.
11. Flat Data Model: The flat model is the earliest, simplest data model. It simply lists all the
data in a single table, consisting of columns and rows. In order to access or manipulate the
1. 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, classes, and courses offered
can be considered as entities. All these entities have some attributes or properties that give
them their identity.
An entity set is a collection of similar types of entities. An entity set may contain entities with
attribute sharing similar values. For example, a Students set may contain all the students of a
school; likewise a Teachers set may contain all the teachers of a school from all faculties. Entity
sets need not be disjoint.
Entities are represented by means of rectangles. Rectangles are named with the entity set they
represent.
2. 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.
There exists a domain or range of values that can be assigned to attributes. For example, a
student's name cannot be a numeric value. It has to be alphabetic. A student's age cannot be
negative, etc. Attributes are the properties of entities. Attributes are represented by means of
ellipses. Every ellipse represents one attribute and is directly connected to its entity
(rectangle).
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.If the attributes
are composite, they are further divided in a tree like structure. Every node is then connected to
its attribute. That is, composite attributes are represented by ellipses that are connected with
an ellipse.
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
example, average_salary in a department should not be saved directly in the database, instead
it can be derived. For another example, age can be derived from data_of_birth.
7. Mapping Cardinalities: Cardinality defines the number of entities in one entity set,
whichcan be associated with the number of entities of other set via relationship set.
One-to-one − One entity from entity set A can be associated with at most one entity of entity
set B and vice versa.
One-to-many − One entity from entity set A can be associated with more than one entities of
entity set B however an entity from entity set B, can be associated with at most one entity.
8. Participation Constraints
Total Participation − Each entity is involved in the relationship. Total participation is
represented by double lines.
Partial participation − Not all entities are involved in the relationship. Partial participation
is represented by single lines.
The ER Model has the power of expressing database entities in a conceptual hierarchical
manner. As the hierarchy goes up, it generalizes the view of entities, and as we go deep in the
hierarchy, it gives us the detail of every entity included.
1.6 Enhanced ER Model: EER is a high-level data model that incorporates the extensions
to the original ER model. It is a diagrammatic technique for displaying the following concepts.
Rule-01: For Strong Entity Set With Only Simple Attributes: A strong entity set with only
simple attributes will require only one table in relational model.
Attributes of the table will be the attributes of the entity set.
The primary key of the table will be the key attribute of the entity set.
First-Name Last-Name
Rule-03: For Strong Entity Set With Multi Valued Attributes: A strong entity set with any
number of multi valued attributes will require two tables in relational model.
One table will contain all the simple attributes with the primary key.
Other table will contain the primary key and all the multi valued attributes.
Roll_no city
Roll_no Mobile-no
Rule-04: Translating Relationship Set into a Table- A relationship set will require one table
in the relational model. Attributes of the table are
Primary key attributes of the participating entity sets
Its own descriptive attributes if any.
Set of non-descriptive attributes will be the primary key.
Rule-05: For Binary Relationships With Cardinality Ratios: The following four cases are
possible
Case-01: Binary relationship with cardinality ratio m:n : in this case separate table for
relationship will be required which will include the attributes which describe the identity of
relation entities i.e. primary key from both entities.
Case-02: For Binary Relationship With Cardinality Ratio 1:n: in this case separate table for
relationship is not required. The table for Relationship can be merged with entity having many
relation. For binary relationship with cardinality ratio either m : 1 or 1 : n , always remember
“many side will consume the relationship” i.e. a combined table will be drawn for many side
entity set and relationship set. Here, combined table will be drawn for the entity set B and
relationship set R.
Case-03: For Binary Relationship With Cardinality Ratio m:1: in this case separate table for
relationship is not required. The table for Relationship can be merged with entity having many
relation. For binary relationship with cardinality ratio either m : 1 or 1 : n , always remember
“many side will consume the relationship” i.e. a combined table will be drawn for many side
entity set and relationship set. Here, combined table will be drawn for the entity set A and
relationship set R.
Case-04: For Binary Relationship With Cardinality Ratio 1:1 For binary relationship with
cardinality ratio 1 : 1 , two tables will be required. You can combine the relationship set with
any one of the entity sets. Here, two tables will be required. Either combine ‘R’ with ‘A’ or ‘B’
Way-01: AR ( a1 , a2 , b1 ) & B ( b1 , b2 )
Way-02: A ( a1 , a2 ) & BR ( a1 , b1 , b2 )
Rule-06: For Binary Relationship With Both Cardinality Constraints and Participation
Constraints:
Cardinality constraints will be implemented as discussed in Rule-05.
Because of the total participation constraint, foreign key acquires NOT NULL constraint i.e.
now foreign key cannot be null.
Case-01: For Binary Relationship With Cardinality Constraint and Total Participation
Constraint From One Side
Because cardinality ratio = 1 : n , so we will combine the entity set B and relationship set R.
Because of total participation, foreign key a1 has acquired NOT NULL constraint, so it can’t be
null now.
Case-02: For Binary Relationship With Cardinality Constraint and Total Participation
Constraint From Both Sides:
If there is a key constraint from both the sides of an entity set with total participation, then
that binary relationship is represented using only single table.
Rule-07: For Binary Relationship With Weak Entity Set-: Weak entity set always appears in
association with identifying relationship with total participation constraint.