UNIT-1A DBMS (1)
UNIT-1A DBMS (1)
UNIT – I
Introduction: Database system, Characteristics (Database Vs File System), Database Users,
Advantages of Database systems, Database applications. Brief introduction of different Data
Models; Concepts of Schema, Instance and data independence; Three tier schema architecture for
data independence; Database system structure, environment, Centralized and Client Server
architecture for the database. Entity Relationship Model: Introduction, Representation of entities,
attributes, entity set, relationship, relationship set, constraints, sub classes, super class,
inheritance, specialization, generalization using ER Diagrams.
Data
Data is the raw material from which useful information is derived. The word
data is the plural of Datum. Data is commonly used in both singular and
plural forms. It is defined as raw facts or observations. It takes variety of
forms, including numeric data, text and voice and images. Data is a
collection of facts, which is unorganized but can be made organized into
useful information. The term Data and Information come across in our daily
life and are often interchanged.
Information
1 Data that have been processed in such a way as to increase the knowledge
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
of the person who uses the data. The term data and information are closely
related. Data are raw material resources that are processed into finished
information products. The information as data that has been processed in
such way that it can increase the knowledge of the person who uses it.
Data Processing
File system is a collection of data. In this system, DBMS is a collection of data. In DBMS, the user is
the user has to write the procedures for managing not required to write the procedures.
the database.
File system provides the detail of the data DBMS gives an abstract view of data that hides the
representation and storage of data. details.
File system doesn't have a crash mechanism, i.e., if DBMS provides a crash recovery mechanism, i.e.,
the system crashes while entering some data, then DBMS protects the user from the system failure.
the content of the file will lost.
It is very difficult to protect a file under the file DBMS provides a good protection mechanism.
system.
File system can't efficiently store and retrieve the DBMS contains a wide variety of sophisticated
data. techniques to store and retrieve the data.
In the File system, concurrent access has many DBMS takes care of Concurrent access of data
problems like redirecting the file while other using some form of locking.
deleting some information or updating some
information.
2
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
A typical DBMS has users with different rights and permissions who use it for different
purposes. Some users retrieve data and some back it up. The users of a DBMS can be broadly
categorized as follows −
3
The following are the major advantages of using a Database Management
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
Data integrity and security: The DBMS can enforce integrity constraints
on the data. The DBMS can enforce access controls that govern what data is
visible to different classes of users.
Data administration: When several users share the data, centralizing the
administration of data can offer significant improvements. It can be used for
organizing the data representation to minimize redundancy and for fine-tuning
the storage of the data to make retrieval efficient.
1. Banking: For customer information, accounts, and loans, and banking transactions.
Data Models
A Data Model in Database Management System (DBMS) is the concept of tools that are
developed to summarize the description of the database. Data Models provide us with a transparent
picture of data which helps us in creating an actual database. It shows us from the design of the
data to its proper implementation of data.
5
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
The conceptual data model describes the database at a very high level and is useful to understand
the needs or requirements of the database. It is this model, that is used in the requirement-gathering
process i.e. before the Database Designers start making a particular database. One such popular
model is the entity/relationship model (ER model). The E/R model specializes in entities,
relationships, and even attributes that are used by database designers. In terms of this concept, a
discussion can be made even with non-computer science(non-technical) users and stakeholders,
and their requirements can be understood.
Entity-Relationship Model( ER Model): It is a high-level data model which is used to define the
data and the relationships between them. It is basically a conceptual design of any database which
is easy to design the view of data.
Components of ER Model:
1. Entity: An entity is referred to as a real-world object. It can be a name, place, object, class, etc.
These are represented by a rectangle in an ER Diagram.
2. Attributes: An attribute can be defined as the description of the entity. These are represented by
Ellipse in an ER Diagram. It can be Age, Roll Number, or Marks for a Student.
3. Relationship: Relationships are used to define relations among different entities. Diamonds and
Rhombus are used to show Relationships.
This type of data model is used to represent only the logical part of the database and does not
represent the physical structure of the database. The representational data model allows us to focus
primarily, on the design part of the database. A popular representational model is a Relational
model. The relational Model consists of Relational Algebra and Relational Calculus. In the
Relational Model, we basically use tables to represent our data and the relationships between them.
It is a theoretical concept whose practical implementation is done in Physical Data Model.
The advantage of using a Representational data model is to provide a foundation to form the base
for the Physical model.
The physical Data Model is used to practically implement Relational Data Model. Ultimately, all
data in a database is stored physically on a secondary storage device such as discs and tapes. This
is stored in the form of files, records, and certain other data structures. It has all the information on
the format in which the files are present and the structure of the databases, the presence of external
data structures, and their relation to each other. Here, we basically save tables in memory so they
can be accessed efficiently. In order to come up with a good physical model, we have to work on
7
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
the relational model in a better way. Structured Query Language (SQL) is used to practically
implement Relational Algebra.
This Data Model describes HOW the system will be implemented using a specific DBMS system.
This model is typically created by DBA and developers. The purpose is actual implementation of
the database.
The physical data model describes data need for a single project or application though it maybe
integrated with other physical data models based on project scope.
Data Model contains relationships between tables that which addresses cardinality and
nullability of the relationships.
Developed for a specific version of a DBMS, location, data storage or technology to be used in
the project.
Columns should have exact datatypes, lengths assigned and default values.
Primary and Foreign keys, views, indexes, access profiles, and authorizations, etc. are defined
Some Other Data Models
1. Hierarchical Model
The hierarchical Model is one of the oldest models in the data model which was developed by IBM,
in the 1950s. In a hierarchical model, data are viewed as a collection of tables, or we can say
segments that form a hierarchical relation. In this, the data is organized into a tree-like structure
where each record consists of one parent record and many children. Even if the segments are
connected as a chain-like structure by logical associations, then the instant structure can be a fan
structure with multiple branches. We call the illogical associations as directional associations.
2. Network Model
The Network Model was formalized by the Database Task group in the 1960s. This model is the
generalization of the hierarchical model. This model can consist of multiple parent segments and
these segments are grouped as levels but there exists a logical association between the segments
belonging to any level. Mostly, there exists a many-to-many logical association between any of the
two segments.
8
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
In the Object-Oriented Data Model, data and their relationships are contained in a single structure
which is referred to as an object in this data model. In this, real-world problems are represented as
objects with different attributes. All objects have multiple relationships between them. Basically, it
is a combination of Object Oriented programming and a Relational Database Model.
Views of data
View of data in DBMS narrate how the data is visualized at each level of data
abstraction. Data abstraction allow developers to keep complex data structures away from
the users. The developers achieve this by hiding the complex data structures through levels of
abstraction.
There is one more feature that should be kept in mind i.e. the data independence. While
changing the data schema at one level of the database must not modify the data schema at the
next level. In this section, we will discuss the view of data in DBMS with data abstraction,
data independence, data schema in detail.
1. Data Abstraction
2. Data Independence
4. Key Takeaways
1. Data Abstraction
Data abstraction is hiding the complex data structure in order to simplify the user’s
interface of the system. It is done because many of the users interacting with the
database system are not that much computer trained to understand the complex data
structures of the database system.
To achieve data abstraction, we will discuss a Three-Schema architecture which
abstracts the database at three levels discussed below:
Three-Schema Architecture:
9 The main objective of this architecture is to have an effective separation between the
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
user interface and the physical database. So, the user never has to be concerned
regarding the internal storage of the database and it has a simplified interaction with the
database system.
The physical or the internal level schema describes how the data is stored in the
hardware. It also describes how the data can be accessed. The physical level shows the
data abstraction at the lowest level and it has complex data structures. Only the
database administrator operates at this level.
It is a level above the physical level. Here, the data is stored in the form of the entity
set, entities, their data types, the relationship among the entity sets, user operations
performed to retrieve or modify the data and certain constraints on the data. Well
adding constraints to the view of data adds the security. As users are restricted to
access some particular parts of the database.
It is the developer and database administrator who operates at the logical or the conceptual
level.
It is the highest level of data abstraction and exhibits only a part of the whole database. It
exhibits the data in which the user is interested. The view level can describe many views
of the same data. Here, the user retrieves the information using different application
from the database.
10
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
In the figure above you can clearly distinguish between the three levels of abstraction. To
understand it more clearly let us take an example:
We have to create a database of a college. Now, what entity sets would be involved?
Student, Lecturer, Department, Course and so on…
Now, the entity sets Student, Lecturer, Department, Course will be stored in the storage as
the consecutive blocks of the memory location. This is the physical or internal level
and is hidden from the programmers but the database administrator is it aware of it.
At the logical level, the programmers define the entity sets and relationship among
these entity sets using a programming language like SQL. So, the programmers work
at the logical level and even the database administrator also operates at this level.
At the view level, the users have the set of applications which they use to retrieve the
data they are interested in.
2. Data Independence
Data independence defines the extent to which the data schema can be changed at one level
without modifying the data schema at the next level. Data independence can be classified as
shown below:
Logical data independence describes the degree up to which the logical or conceptual schema
can be changed without modifying the external schema. Now, a question arises what is the
need to change the data schema at a logical or conceptual level?
Well, the changes to data schema at the logical level are made either to enlarge or reduce the
database by adding or deleting more entities, entity sets, or changing the constraints on data.
Physical data independence defines the extent up to which the data schema can be changed at the
physical or internal level without modifying the data schema at logical and view level.
Well, the physical schema is changed if we add additional storage to the system or we
reorganize some files to enhance the retrieval speed of the records.
3. Instance
s and
Schemas
What is an
instance?
We can define an instance as the information stored in the database at a particular point of
time. Let us discuss it with the help of an example.
As we discussed above the database comprises of several entity sets and the relationship
12 between them. Now, the data in the database keeps on changing with time. As we keep
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
Now, at a particular time if we retrieve any information from the database then that
corresponds to an instance.
What is schema?
Whenever we talk about the database the developers have to deal with the definition of
database and the data in the database.
The definition of a database comprises of the description of what data it would contain
what would be the relationship between the data. This definition is the database schema.
4. Key Takeaways:
The physical level of abstraction defines how data is stored in the storage and also
reveals its access path.
Abstraction at the logical level describes what data would be stored in the database?
what would be the relation between the data? and the constraints applied to the
data.
The view level or external level of abstraction describes the application which the users
use to retrieve the information from the database.
Data independence explains the extent to which data at a certain level can be
modified without disturbing the data next higher levels.
An instance is the retrieval of information from the database at a certain point of time.
An instance in a database keeps on changing with time.
Schema is the overall design of the entire database. Schema of the database is not changed
frequently.
So that’s all about the view of data in the database which help us to understand the database
from users, developers and database administrator aspects.
Database Languages
A DBMS has appropriate languages and interfaces to express database queries and
13
updates.
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
Database languages can be used to read, store and update the data in the database.
DDL stands for Data Definition Language. It is used to define database structure or
pattern.
It is used to create schema, tables, indexes, constraints, etc. in the database.
Using the DDL statements, you can create the skeleton of the database.
Data definition language is used to store the information of metadata like the
number of tables and schemas, their names, indexes, columns in each table,
constraints, etc.
Here are some tasks that come under DDL:
DML stands for Data Manipulation Language. It is used for accessing and manipulating data
in a database. It handles user requests.
DCL stands for Data Control Language. It is used to retrieve the stored or saved data.
The DCL execution is transactional. It also has rollback parameters.
(But in Oracle database, the execution of data control language does not have the
feature of rolling back.)
Here are some tasks that come under DCL:
TCL is used to run the changes made by the DML statement. TCL can be grouped into a
logical transaction. Here are some tasks that come under TCL:
Commit: It is used to save the transaction on the database.
Rollback: It is used to restore the database to original since the last Commit.
• The advancements in technology have opened the floodgates for endless volumes of
data to flow into the system. With this tremendous amount of data pouring in from
diverse sources and in multiple formats, it becomes a critical task for organizations to
store, process and manage this data. And even more so in today’s data driven world,
where it has become the key to business success.
• A robust and efficient database management system resolves all your data worries,
giving your business the power to lead.
The architecture of a database system is greatly influenced by the underlying computer system on
which the database is running:
i. Centralized.
ii. Client-server.
iv. Distributed
16
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
Database Users:
Users are differentiated by the way they expect to interact with the system:
Application programmers:
Sophisticated users:
o Sophisticated users interact with the system without writing programs. Instead,
they form their requests in a database query language.
o They submit each such query to a query processor, whose function is to
break down DML statements into instructions that the storage manager
understands.
Specialized users :
Naive users :
o Naive users are unsophisticated users who interact with the system by
invoking one of the application programs that have been written previously.
o For example, a bank teller who needs to transfer $50 from account A to
account B invokes a program called transfer. This program asks the teller for
17 the amount of money to be transferred, the account from which the money is to
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
Database Administrator:
DDL interpreter
This will interprets 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.
This engine will execute low-level instructions generated by the DML compiler on DBMS.
A storage manager is a program module which acts like interface between the
data stored in a database and the application programs and queries submitted
to the system.
Thus, the storage manager is responsible for storing, retrieving and updating data in the
database.
o File manager: Manages the allocation of space on disk storage and the data
structures used to represent information stored on disk.
o 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.
Data Dictionary
Example
<StudentPersonalDetails>
The DBMS software manages the active data dictionary automatically. The modification is an
automatic task and most RDBMS has active data dictionary. It is also known as integrated
data dictionary.
Managed by the users and is modified manually when the database structure change. Also
known as non- integrated data dictionary.
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.
20
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
1-Tier Architecture
2-Tier Architecture
3-Tier Architecture
1-Tier Architecture
In 1-Tier Architecture the database is directly available to the user, the user can
directly sit on the DBMS and use it that is, the client, server, and Database are all
present on the same machine. This setup is simple and is often used in personal or
standalone applications where the user interacts directly with the database.
For Example: A Microsoft Excel spreadsheet is a great example of one-tier
architecture.
21
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
1. Client Layer (Tier 1): This is the user interface that library staff or users interact
with. For example they might use a desktop application to search for books, issue
them, or check due dates.
2. Database Layer (Tier 2): The database server stores all the library records such
as book details, user information, and transaction logs.
The client layer sends a request (like searching for a book) to the database layer
which processes it and sends back the result. This separation allows the client to
focus on the user interface, while the server handles data storage and retrieval.
22
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
Easy to Access: 2-Tier Architecture makes easy access to the database, which
makes fast retrieval.
Scalable: We can scale the database easily, by adding clients or upgrading
hardware.
Low Cost: 2-Tier Architecture is cheaper than 3-Tier Architecture and Multi-
Tier Architecture .
Easy Deployment: 2-Tier Architecture is easier to deploy than 3-Tier
Architecture.
Simple: 2-Tier Architecture is easily understandable as well as simple because of
only two components.
3-Tier Architecture
In 3-Tier Architecture , there is another layer between the client and the server. The
client does not directly communicate with the server. Instead, it interacts with an
application server which further communicates with the database system and then
the query processing and transaction management takes place. This intermediate
23 layer acts as a medium for the exchange of partially processed data between the
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
server and the client. This type of architecture is used in the case of large web
applications.
For Example: E-commerce Store
User: You visit an online store, search for a product and add it to your cart.
Processing: The system checks if the product is in stock, calculates the total price
and applies any discounts.
Database: The product details, your cart and order history are stored in the database
for future reference.
24
DATABASE MANAGEMENT SYSTEMS UNIT – I : INTRODUCTION
25