Unit 1 - Database Management System
Unit 1 - Database Management System
Tech
Subject Name: Database Management System
Subject Code: IT-405
Semester: 4th
Downloaded from be.rgpvnotes.in
Class Notes
SEMESTER: -IT-IV SEM Subject Name: -DBMS
UNIT -I
Introduction
The database is a collection of similar data. The database management system is software designed to assist
the maintenance and utilisation of large-scale collection of data. DBMS came into existence in 1960 by
Charles. Integrated data store which is also called as the first general-purpose DBMS. Again in 1960 IBM
brought IMS-Information management system. In 1970 Edgar Codd at IBM came with a new database called
RDBMS. In 1980 then came SQL Architecture- Structure Query Language. From 1980 to 1990 there were
advances in DBMS, e.g. DB2, ORACLE.
Data
• Data is raw fact or figures or entity.
• Whe a ti ities i the organisation take place, the effect of these activities needs to be recorded which is
known as Data.
Information
Processed data is called information
The purpose of data processing is to generate the information required for carrying out business activities.
Database
Let us understand first about the what is a database. So, a database is a set of data, and it contains
interrelated data. The database contains a set of algorithm and rules through which data can be stored in it
systematically. So, all the data fields must be related to each other. For example, where it is used suppose
an organisation from attendance, salary calculation and different allowances are given to them can be done
through the Database. To keep a record nowadays from billing an item to take attendance is the classroom
database is required.
Evolution of DBMS: -
A Database Management System (DBMS) is a collection of programs that enables the user to create and
maintain a database.
The DBMS is hence a general-purpose software system that facilitates the process of defining constructing
and manipulating database for various applications.
Comparison Between File System & DBMS
RDBMS
A relational database management system is a database management system used to manage relational
databases. A relational database is one where tables of data can have
relationships based on primary and foreign keys.
Advantages of DBMS
Due to its centralised nature, the database system can overcome the disadvantages of the file system-based
system
● Concurrent Use a database system provides facility to access database several users concurrently. Let
we understand it by taking an example that a movie online booking system database employee of
different branches concurrently access the database. Each employee can handle customers at their desk,
Able to see the seats available for the booking from the interface provided to them.
● Structured data & details one of the essential features of the database system is not only to store the
data and to provide access to the database. However, it also provides details about the data and how to
access and use it. Taking an example when you are going for an online form of exam then details about
every field is given, what type of data it accepts and format details also.
● Data Independence, another essential characteristic of the DBMS, is data independence in which
application through which user can interact with the user is not dependent on the physical data storage.
So, if there is any change in the application program, it will not affect the data stored in the database.
● The integrity of data This characteristic of the DBMS deals with one of the fundamental properties of
the data called integrity, in which if some data is saved in the database and later retrieved from the
database it must be same. This also covers restriction on the unauthorised access of the data that can
make changes in the data sets.
● Transaction of Data, a transaction is a set of actions that are done in a database to transfer it from one
consistent state to another. If it is not handled correctly, it may result in inconsistent state and loss of
data, so DBMS has certain constraints to maintain the fundamental properties of transaction like
atomicity, integrity, isolation, and durability.
● Data Persistence, this is one of the essential characteristics of the database because data can be retained
in the database for years and it should be in the same condition. In the banking system, a user will open
his account and lifelong maintain it, or a user has opted an LIC policy, or media claim policy.
Real-world entity − A oder DBMS is ore realisti a d uses real-world entities to design its architecture.
It uses the behaviour and attributes too. For example, a school database may use students as an entity and
their age as an attribute.
Relation-based tables − DBMS allo s e tities a d relatio s a o g the to for ta les. A user a
understand the architecture of a database just by looking at the table names.
Isolation of data and application − A data ase s ste is e tirel differe t from its data. A database is an
active entity, whereas data is said to be passive, on which the database works and organises. DBMS also
stores metadata, which is data about data, to ease its process.
Less redundancy − DBMS follo s the rules of normalisation, which splits a relation when any of its attributes
is having redundancy in values. Normalisation is a mathematically rich and scientific process that reduces
data redundancy.
Consistency − is a state where every relation in a database remains consistent. There exist methods and
techniques, which can detect an attempt of leaving the database in the inconsistent state.
Query Language − DBMS is equipped with a query language, which makes it more efficient to retrieve and
manipulate data. A user can apply as many and as different filtering options as required to retrieve a set of
data. Traditionally it was not possible where the file-processing system was used.
ACID Properties − DBMS follo s the o epts of Ato i it , Co siste , Isolatio , a d Dura ilit (commonly
shortened as ACID). These concepts are applied to transactions, which manipulate data in a database.
Multiuser and Concurrent Access − DBMS supports ulti-user environment and allows them to access and
manipulate data in parallel. Though there are restrictions on transactions when users attempt to handle the
same data item, users are always unaware of them.
Multiple views − DBMS offers multiple views for different users. A user who is in the Sales department will
have a different view of a database than a person working in the Production department. This feature
enables the users to have a concentrated view of the database according to their requirements.
Security − Features like ultiple ie s offer se urit to so e e te t here users are u a le to a ess data
from other users and departments. DBMS offers methods to impose constraints while entering data into the
database and retrieving the same at a later stage.
DBMS Architecture: -
The design of a DBMS depends on its architecture. It can be centralised or decentralised or hierarchical. The
architecture of a DBMS be either single tier or multi-tier. An n-tier architecture divides the entire system into
related but independent n modules, which can be independently modified, altered, changed, or replaced.
In 1-tier architecture, the DBMS is the only entity where the user directly sits on the DBMS and uses it. Any
changes done here will directly be done on the DBMS itself. It does not provide handy tools for end-users.
Database designers and programmers usually prefer to use single-tier architecture.
If the architecture of DBMS is 2-tier, then it must have an application through which the DBMS can be
accessed. Programmers use a 2-tier architecture where they access the DBMS using an application. Here the
application tier is entirely independent of the database regarding operation, design, and programming.
3-Tier Architecture
Database (Data) Tier − At this tier, the database resides along with its query processing languages. We also
have the relations that define the data and their constraints at this level.
Application (Middle) Tier − At this tier reside the appli atio ser er a d the programs that access the
database. For a user, this application tier presents an abstracted view of the database. End-users are
unaware of any existence of the database beyond the application. At the other end, the database tier is not
aware of any other user beyond the application tier. Hence, the application layer sits in the middle and acts
as a mediator between the end-user and the database.
User (Presentation) Tier − E d-users operate on this tier, and they know nothing about any existence of the
database beyond this layer. At this layer, multiple views of the database can be provided by the application.
All views are generated by applications that reside in the application tier.
Users are differentiated by the way they expect to interact with the system:
Application programmers:
Application programmers are computer professionals who write application programs. Application
programmers can choose from many tools to develop user interfaces.
Rapid application development (RAD) tools are tools that enable an application programmer to construct
forms and reports without writing a program.
Sophisticated users:
Sophisticated users interact with the system without writing programs. Instead, they form their requests in
a database query language.
Specialised users:
Specialised users are sophisticated users who write specialised database applications that do not fit into the
traditional data-processing framework.
Naïve users:
Naive users are unsophisticated users who interact with the system by invoking one of the application
programs that have been written previously.
Database Administrator:
Coordinates all the activities of the database system. The database administrator has a good understanding
of the e terprise’s i for atio resour es a d eeds.
Query Processor:
The query processor will accept a query from a user and solves it by accessing the database.
Parts of Query processor:
DDL interpreter
This will interpret DDL statements and fetch the definitions in the data dictionary.
DML compiler
a. This will translates DML statements in a query language into low-level instructions that the query
evaluation engine understands.
b. A query can usually be translated into any of some alternative evaluation plans for same query result DML
compiler will select the best plan for query optimisation.
Query evaluation engine
This engine will execute low-level instructions generated by the DML compiler on DBMS.
Storage Manager/Storage Management:
A storage manager is a program module which acts as an interface between the data stored in a database
and the application programs and queries submitted to the system.
The storage manager components include:
Authorisation and integrity manager: Checks for integrity constraints and authority of users to access data.
Transaction manager: Ensures that the database remains in a consistent state although there are system
failures.
File manager: Manages the allocation of space on disk storage and the data structures used to represent
information stored on disk.
Buffer manager: It is responsible for retrieving data from disk storage into main memory. It enables the
database to handle data sizes that are much larger than the size of main memory.
The very first data model could be flat data models, where all the data used are to be kept in the same plane.
Earlier data models were not so scientific; hence they were prone to introduce lots of duplication and update
anomalies.
There are many kinds of data models. Some of the most common ones include:
The most common model, the relational model sorts data into tables, also known as relations, each of which
consists of columns and rows. Each column lists an attribute of the entity in question, such as price, zip code,
or birth date. Together, the attributes in a relation are called a domain. An attribute or combination of
attributes is chosen as a primary key that can be referred to in other tables when it is called a foreign key.
Each row also called a tuple, includes data about a specific instance of the entity in question, such as an
employee.
The model also accounts for the types of relationships between those tables, including one-to-one, one-to-
many, and many-to- a relatio ships. Here’s a e a ple:
Relational model: -
Within the database, tables can be normalised, or brought to comply with normalisation rules that make the
database flexible, adaptable, and scalable. When normalised, each piece of data is atomic or broken into the
smallest useful pieces.
Relational databases are typically written in Structured Query Language (SQL). E.F. Codd introduced the
model in 1970.
Hierarchical model
The hierarchical model organises data into a tree-like structure, where each record has a single parent or
root. Sibling records are sorted in an order. That order is used as the physical order for storing the database.
This model is useful for describing many real-world relationships.
Network model
The network model builds on the hierarchical model by allowing many-to-many relationships between linked
records, implying multiple parent records. Based on mathematical set theory, the model is constructed with
sets of related records. Each set consists of one owner or parent record and one or more member or child
records. A record can be a member or child in multiple sets, allowing this model to convey complex
relationships.
This model defines a database as a collection of objects, or reusable software elements, with associated
features and methods. There are several kinds of object-oriented databases:
A multimedia database incorporates media, such as images, that could not be stored in a relational database.
A hypertext database allows any object to link to any other object. It is useful for organising lots of disparate
data, but it is not ideal for numerical analysis.
The object-oriented database model is the best known post-relational database model, since it incorporates
ta les, ut is ’t li ited to ta les. Su h odels are also k o as h rid data ase odels.
Object-relational model
This hybrid database model combines the simplicity of the relational model with some of the advanced
functionality of the object-oriented database model. It allows designers to incorporate objects into the
simple table structure.
Languages and call interfaces include SQL3, vendor languages, ODBC, JDBC, and proprietary call interfaces
that are extensions of the languages and interfaces used by the relational model.
Entity-relationship model
This model captures the relationships between real-world entities much like the network model, but it is not
as directly tied to the physical structure of the database. Instead, it is 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 specific attributes that together make up their domain. The cardinality, or relationships between
entities, are mapped as well.
In addition to the object database model, other non-SQL models have emerged in contrast to the relational
model: The graph database model, which is even more flexible than a network model, allowing any node to
connect with any other — the multi-valued model, which breaks from the relational model by allowing
attributes to contain a list of data rather than a single data point.
Physical schema: - The design of a database at the physical level is called physical schema, how the data
stored in blocks of storage is described at this level.
Logical schema: - Design of database at a logical level is called logical schema, programmers and database
administrators work at this level, at this level data can be described as certain types of data records gets
stored in data structures, however the internal details such as implementation of data structure is hidden
at this level (available at physical level).
View schema: - Design of database at view level is called view schema. This generally describes end-user
interaction with database systems.
Instances: - The data stored in a database at a moment of time is called an instance of the database. The
database schema defines the variable declarations in tables that belong to a database the value of these
variables at a moment of time is called the instance of that database.
Data Independence
A database system contains typically many data i additio to users’ data. For e a ple, it stores data a out
data, known as metadata, to locate and retrieve data quickly. It is rather difficult to modify or update a set
of metadata once it is stored in the database. However, as a DBMS expands, it needs to change over time to
satisfy the requirements of the users.
Logical data independence is a kind of mechanism, which liberalises itself from actual data stored on the
disk. If we do some changes in table format, it should not change the data residing on the disk.
For e a ple, i ase e a t to ha ge or upgrade the storage s ste itself − suppose e a t to repla e
hard-disks ith SSD − it should ot ha e any impact on the logical data or schemas. Requirements of the
users. If the entire data is dependent, it will become a tedious and highly complex job.
DBA
A data administration (also known as a database administration manager, data architect, or information
centre manager) is a high-level function responsible for the overall management of data resources in an
organisation. In order to perform its duties, the DA must know a good deal of system analysis and
programming.
These are the functions of a data administrator (not to be confused with database administrator
functions):
E-R Diagram
ER Model is represented using an ER diagram. Any object, for example, entities, attributes of an entity,
relationship sets, and attributes of relationship sets, can be represented with the help of an ER diagram.
Entity
Entities are represented using rectangles. Rectangles are named with the entity set they represent.
Strong Entity: - This type of entities has key attributes set that are used to create a primary key. Like
EX. Student, Faculty, Course
Weak Entity: - This type of Entities does not have any primary key attribute, and they are dependent on
student entity has Roll no as a critical attribute.
some other entity have the crucial prime attribute. For example, Employee child is a weak entity some
other entity has the crucial prime attribute. For example, Employee child is a weak entity which is
Composite Entity: - This type of entities is used to replace many to many relationships, and Entity
dependent on the Employee Entity.
replaces that relationship. It is of three types one-to-one cardinality, one-to-many cardinality, many-to-
many cardinality.
Attributes
Attributes are the properties of entities. Attributes are represented using ellipses. Every ellipse represents
one attribute and is directly connected to its entity (rectangle).
Derived attributes: - This is the attributes that can be derived from other attributes. Like Age can be derived
from the present date and Date of Birth.
Composite Attribute: - This is the attributes that can be created with the combination of two other
attributes. Like a combination of first name and Last name will give the full name.
Single-value attribute: - This is the attributes which have single value when they are converted in the form
of a table. Like DOB of a person.
Multi-Valued Attribute: - This is the attributes which have multiple values for the instance When an Entity
is converted to a table, and that attribute allows multiple values for it. Like a person have two contact
numbers.
3) Relationship
A Relationship describes relations between entities. The relationship is represented using diamonds.
Binary Relationship
One to One: This type of relationship is rarely seen in the real world.
Binary Relationship means the relation between two Entities. This is further divided into three types.
The above example describes that one student can enrol only for one course and a course will also have only
One to Many: It reflects business rule that one entity is associated with any numbers of the same
one Student. This is not what you will usually see in the relationship.
entity.
The example for this relation might sound a little weird, but this means that one student can enrol too many
courses, but one course will have one Student.
Many to One: It reflects a business rule that many entities can be associated with just one entity. For
The arrows in the diagram describe that one student can enrol for only one course.
example, Student enrols for only one Course, but a Course can have many Students.
Many to Many:
The above diagram represents that many students can enrol for more than one courses.
Recursive Relationship
When an Entity is related with itself, it is known as Recursive Relationship.
Ternary Relationship
Relationship of degree three is called Ternary relationship.
Here we are going to design an Entity Relationship (ER) model for a college database.
We have the following statements.
● Only one instructor teaches one course. However, one instructor teaches many courses. Hence the
cardinality between the course and the instructor is Many to One (N: 1)
Step 3: Identify the key attributes
● "Departmen_Name" can identify a department uniquely. Hence Department Name is the key
attribute for the Entity "Department".
● Course_ID is the critical attribute for "Course" Entity.
● Student_ID is the critical attribute for "Student" Entity.
● Instructor_ID is the critical attribute for "Instructor" Entity.