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

DMS Chapter-1 Notes

Uploaded by

umarclg1234
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

DMS Chapter-1 Notes

Uploaded by

umarclg1234
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

1.

Introduction to Database System

 DATA:

 In the context of a DBMS, data refers to the collection of facts,


figures, and other information that is stored and managed within a
database. It's the raw material that is processed, analyzed, and used
to generate valuable insights.
 Data can be anything such as, text, number, images, audio, video
etc.
For example, “john”, “19”, “student” etc.
 When the data is processed and converted into a meaningful and
useful form known as information.
For example, “john is 19 year old and he is a student”.
 DATABASE:

 Database is a collection of data. The database is used to store


information useful to an organization. Database contains
information about one particular enterprise or organization.
 A Library Database:
Let's consider a library as another example of a database.
The library can use the database to keep track of its book
collection.
It can manage member information and their borrowing history.

Books: Book ID, Title, Author, Publication Year.


Members: Member ID, Name, Address, Contact Information
Loans: Member ID, Book ID, Due Date, Return Date

 DATABASE MANAGEMENT SYSTEM (DBMS):


 A Database Management System(DBMS) is an integrated set of
programs used to create and maintain a database.
 A Database Management System(DBMS) is a software system that
allows user to define, manipulate and process the data in database,
in order to produce meaningful information
 Some of the popular relational database management systems
include Microsoft Access, MySQL, Oracle, SQLite, MariaDB.
 Key Functions of a DBMS:

 Data Definition: Defining the structure of the database, including


tables, columns, data types, and relationships.
 Data Manipulation: Inserting, updating, deleting, and retrieving
data from the database.
 Data Query: Retrieving specific information from the database
using query languages like SQL.
 Data Integrity: Ensuring data accuracy and consistency through
validation rules and constraints.
 Data Security: Protecting data from unauthorized access,
modification, or deletion.
 Concurrency Control: Managing simultaneous access to the
database by multiple users.
 Recovery and Backup: Restoring the database to a previous state
in case of failures or disasters.

 FILE SYSTEM:

 Earlier file processing system was used to store the data or


database. The database was stored in a typical operating
system file.
 File system also known as conventional file system is oldest
way of keeping the data files.
 To access the data from these flat files, various programs are
written.
 In below figure:
Consider an example of a student's file system. The student
file will contain information regarding the student (i.e. roll
no, student name, course etc.). Similarly, we have a subject
file that contains information about the subject and the result
file which contains the information regarding the result.

Some fields are duplicated in more than one file, which leads
to data redundancy. So to overcome this problem, we need to
create a centralized system, i.e. DBMS approach.

File system

Advantages of File Processing System :

 Cost friendly
There is a very minimal to no set up and usage fee for File
Processing System. (In most cases, free tools are inbuilt in
computers.)

 Easy to use
File systems require very basic learning and understanding, hence,
can be easily used.

 High scalability
One can very easily switch from smaller to larger files as per his
needs.
Disadvantages of File Processing System :

 Slow access time


Direct access of files is very difficult and one needs to know the
entire hierarchy of folders to get to a specific file. This involves a lot
of time.

 Presence of redundant data


The same data can be present in two or more files which takes up
more disc space.

 Inconsistent Data
Due to data redundancy, same data stored at different places might
not match to each other.

 Data Integrity Problems


The data present in the database should be consistent and correct. To
achieve this, the data should must satisfy certain constraints.

 DATABASE SYSTEM:

 The database software together with the database is called a


database system.
 Database system is a system whose overall purpose is to
record and maintain information.
 A database approach is a well-organized collection of data
that are related in a meaningful way which can be accessed
by different users but stored only once in a system.
 The various operations performed by the DBMS system are:
Insertion, deletion, selection, sorting etc.
 In the below figure, duplication of data is reduced due to
centralization of data.

Database system

 ADVANTAGE OF DBMS OVER FILE


PROCESSING SYSTEM
 Data Redundancy and Inconsistency:

Redundancy means repeating the data in a system. In a normal file


system, there is a high chance that there can be various files of the
same data used by different users for specific purposes. If any user
changes the data in its files, then the changes are not reflected in all
files.

 Data Sharing:
In the normal file system, data sharing is too difficult because file
sharing is a complex task. In DBMS, all the data is centralized, so
data sharing is a very easy task.

 Data Concurrency:

When more than one user accesses the database simultaneously,


then it is called concurrency. In a file system, when multiple users
are using the files at the same time, then there may be a chance of
anomalies in the data due to changes, and it does not provide any
method to detect anomalies. But in DBMS, we have a locking
system to detect the anomalies so we can protect the data.

 Data Searching:

To search the data in a file system, we have to write a specific


program and run it. In DBMS, we have query languages by which
we can write small queries to get the data we want from the
database. We can use various query languages, like MySQL.

 System Crashing:

There are various reasons by which our system can crash. Once a
system crashes, the file system loses all its files and data, and we
can not recover it again. But DBMS has a recovery manager which
can recover the data if the system crashes.
 Data Security:

In the file system, we have only password protection to save the


files and data, but it is not reliable. In DBMS, we have special
algorithms and features to secure the data.

 Maintenance:

The file system is not maintained easily because it is decentralized,


whereas DBMS is a centralized system, so it becomes easy to
maintain it.

 APPLICATION OF DBMS
A Database Management System (DBMS) is a software application that
interacts with end-users, applications, and the database itself to capture
and analyze data. Its applications span across various industries and
sectors.
1. Railway Reservation System
In the rail route reservation framework, the information base is needed
to store the record or information of ticket appointments, status of
train’s appearance, and flight.

2. Library Management System


There are many books in the library so; it is difficult to store the record
of the relative multitude of books in a register or duplicate. Along these
lines, the data set administration framework (DBMS) is utilized to keep
up all the data identified with the name of the book, issue date,
accessibility of the book, and its writer.

3. Banking
It is one of the major applications of databases. Banks have a huge
amount of data as millions of people have accounts that need to be
maintained properly. The database keeps the record of each user in a
systematic manner.
4. Universities
It is an undeniable application of the database. Universities have so
much data which can be stored in the database, such as student
information, teacher information, non-teaching staff information, course
information, section information, grade report information, and many
more. University information is kept safe and secure in the database.
5. Social media sites
Nowadays, everyone has a smartphone and accounts on various social
media sites like Facebook, LinkedIn, Pinterest, Twitter, Instagram, etc.
People can chat with their friends and family and make new friends from
all over the world. Social media has millions of accounts, which means
they have a huge amount of data that needs to be stored and maintained.
Social media sites use databases to store information about users,
images, videos, chats, etc.
6. E-commerce
E-commerce websites are one of the prominent applications of the
database. Websites such as Flipkart, Myntra, Amazon, Nykaa, Snapdeal,
Shopify, and many more, are online shopping websites where people
buy items online. These websites have so much data. These websites use
databases to securely store and maintain customer details, product
details, dealer details, purchase details, bank & card details, transactions
details, invoice details, etc.
7.Medical
There is a lot of important data collection in the medical field, so it is
necessary to use the database to store data related to the medical field,
such as patient details, medicine details, practitioner details, surgeon
details, appointment details, doctor schedule, patient discharge details,
payment detail, invoices, and other medical records.
8. Accounting and finance
When there is big data regarding accounting and finance, there is a need
to maintain a large amount of data, which is done with the help of a
database. The database stores data such as accounting details, bank
details, purchases of stocks, invoice details, sales records, asset details,
etc. Accounting and finance database helps in maintaining and analyzing
historical data.
9.Industries
The database management system is the main priority of industries
because they need to store huge amounts of data. The industry database
stores customer details, sales records, product lists, transactions, etc. All
the information is kept secure and maintained by the database.
10.Airlines system
It is one of the applications of database management systems that
contain data such as passenger name, passenger check-in, passenger
departure, flight schedule, number of flights, distance from source to
destination, reservation information, pilot details, accounting detail,
route detail, etc.
11. Telecommunication
In telecommunication database is required, which stores data such as
customer names, phone numbers, calling details, prepaid & post-paid
connection records, network usage, bill details, balance details, etc.
12. Human resource management
The human resource database stores data such as employee name,
joining details, designation, salary details, tax information, benefits &
goodies details, etc.

 DATA ABSTRACTION

 The database system contains intricate data structures and


relations. The developers keep away the complex data from the
user and remove the complications so that the user can comfortably
access data in the database and can only access the data they want,
which is done with the help of data abstraction.
 The main purpose of data abstraction is to hide irrelevant data and
provide an abstract view of the data.
 With the help of data abstraction, developers hide irrelevant data
from the user and provide them the relevant data. By doing this,
users can access the data without any hassle, and the system will
also work efficiently.
 Levels of Data Abstraction In DBMS

There are three levels of data abstraction, which are as follows:

1. Physical Level:
 This is the lowest level of data abstraction. It tells us how the data
is actually stored in memory.
 It is the layer that defines how data is actually stored in the
database. It defines methods to access the data in the database. It
defines complex data structures in detail, so it is very complex to
understand, which is why it is kept hidden from the end user.
 Data Administrators (DBA) decide how to arrange data and where
to store data.
2. Logical Level:
 The logical or conceptual level is the intermediate or next
level of data abstraction.

 It explains what data is going to be stored in the database and


what the relationship is between them.

 It describes the structure of the entire data in the form of


tables. The logical level or conceptual level is less complex
than the physical level.

3. View Level:
 View or External Level is the highest level of data
abstraction.
 There are different views at this level that define the parts of
the overall data of the database.
 This level is for the end-user interaction; at this level, end
users can access the data based on their queries.
 Even though the logical level uses simpler structures,
complexity remains because of the variety of information
stored in a large database. Many users of the database
system do not need all this information; instead, they need to
access only a part of the database.
 DATA INDEPENDENCE

 Data independence can be explained using the three-schema


architecture.
 Data independence refers characteristic of being able to modify
the schema at one level of the database system without altering
the schema at the next higher level.

Fig.Data Independence

There are two types of data independence:

1.Logical Data Independence

 Changing the logical schema (conceptual level) without changing


the external schema (view level) is called logical data
independence.
 It is used to keep the external schema separate from the logical
schema.
 If we make any changes at the conceptual level of data, it does not
affect the view level.
 For example, it is possible to add or delete new entities, attributes
to the conceptual schema without making any changes to the
external schema.

2.Physical Data Independence

 Making changes to the physical schema without changing the logical


schema is called physical data independence.
 If we change the storage size of the database system server, it will
not affect the conceptual structure of the database.
 It is used to keep the conceptual level separate from the internal
level.

 DATABASE SCHEMA

 A database schema is a logical representation of data that shows


how the data in a database should be stored logically. It shows how
the data is organized and the relationship between the tables.

 Database schema contains table, field, views and relation between


different keys like primary key, foreign key.
.
There are 3 types of database schema:

1.Physical Database Schema


 A Physical schema defines, how the data or information is stored
physically in the storage systems in the form of files & indices. This
is the actual code or syntax needed to create the structure of a
database, we can say that when we design a database at a physical
level, it’s called physical schema.
2.Logical Database Schema
 A logical database schema defines all the logical constraints that
need to be applied to the stored data, and also describes tables,
views, entity relationships, and integrity constraints.

3.View Database Schema


 It is a view level design which is able to define the interaction
between end-user and database.

Fig.Database Schema
 DATABASE INSTANCE

In DBMS, the data is stored for a particular amount of time and is called
an instance of the database. The database schema defines the attributes
of the database in the particular DBMS. The value of the particular
attribute at a particular moment in time is known as an instance of the
DBMS.

example: Let's say we have a single table student in the database; today,
the table has 100 records, so today, the instance of the database has 100
records. We are going to add another 100 records to this table by
tomorrow, so the instance of the database tomorrow will have 200
records in the table. In short, at a particular moment, the data stored in
the database is called the instance; this change over time as and when we
add, delete or update data in the database.

 CODD’S RULE
Codd’s rules are proposed by a computer scientist named Dr. Edgar F.
Codd in 1985 and he also invent the relational model for database
management.
Rule 1: The Information Rule
All information, whether it is user information or metadata, that is
stored in a database must be entered as a value in a cell of a table. It is
said that everything within the database is organized in a table layout.

Rule 2: The Guaranteed Access Rule


Each data element is guaranteed to be accessible logically with a
combination of the table name, primary key (row value), and attribute
name (column value).
Rule 3: Systematic Treatment of NULL Values
This rule defines the systematic treatment of Null values in database
records. The null value has various meanings in the database, like
missing the data, no value in a cell, inappropriate information, unknown
data and the primary key should not be null.
Rule 4: Active Online Catalog Rule
It represents the entire logical structure of the descriptive database that
must be stored online and is known as a database dictionary. It
authorizes users to access the database and implement a similar query
language to access the database.
Rule 5: The Comprehensive Data Sublanguage Rule
A database can only be accessed using a language having linear syntax
that supports data definition, data manipulation, and transaction
management operations
Rule 6: The View Updating Rule
All views that are theoretically updatable must also be updatable by the
system.

Rule 7: High-level Insert, Update, and Delete


A successful database system must possess the feature of facilitating
high-level insertions, updates, and deletions that can grant users the
ability to conduct these operations with ease through a single query.

Rule 8: Physical Data Independence

The data stored in a database must be independent of the applications


that access the database. Any change in the physical structure of a
database must not have any impact on how the data is being accessed by
external applications.

Rule 9: Logical Data Independence


The logical data in a database must be independent of its user’s view
(application). Any change in logical data must not affect the applications
using it. For example, if two tables are merged or one is split into two
different tables, there should be no impact or change on the user
application. This is one of the most difficult rule to apply.

Rule 10: Integrity Independence

A database must be independent of the application that uses it. All its
integrity constraints can be independently modified without the need of
any change in the application.

Rule 11: Distribution Independence

The end-user must not be able to see that the data is distributed over
various locations. Users should always get the impression that the data is
located at one site only. This rule has been regarded as the foundation of
distributed database systems.

Rule 12: Non-Subversion Rule


If the interface of the system is providing access to low-level records,
then the interface must not be able to damage the system and bypass
security and integrity constraints.

 OVERALL STRUCTURE OF DBMS

The structure of DBMS defines the components are identified, the


function of each component is specified and inter-relationships and
interactions among these components are defined.

Users of DBMSs include application programmers, Database


Administrators (DBAs), and end users.

Database Administrators are typically the only people who work directly
with a DBMS.
The database system is divided into three components: Query
Processor, Storage Manager, and Disk Storage.

1. Query Processor

The query processing is handled by the query processor, as the


name implies. It executes the user's query, to put it simply. In this
way, the query processor aids the database system in making data
access simple and easy.

 DML Compiler:

Compiler for DML Data Manipulation Language is what DML


stands for. In keeping with its name, the DML Compiler converts
DML statements like select, update, and delete into low-level
instructions or simply machine-readable object code, to enable
execution

 DDL Interpreter:

Data Definition Language is what DDL stands for. As implied by


the name, the DDL Interpreter interprets DDL statements like
those used in schema definitions (such as create, remove, etc.).

 Embedded DML Pre-compiler:

Before the query evaluation, the embedded DML commands in the


application program (such as SELECT, FROM, etc., in SQL) must
be pre-compiled into standard procedural calls (program
instructions that the host language can understand).

 Query evaluation engine

Query evaluation engine evaluates the SQL commands used to


access the database's contents before returning the result of the
query.
It interprets the requests (queries) received from end user via an
application program into instructions. It also executes the user
request which is received from the DML compiler.

2. Storage Manager

Storage Manager is a program that provides an interface between the


data stored in the database and the queries received. It is also known as
Database Control System.

 Authorization Manager:

Authorization manager verifies the user that he is valid and


authenticated for the specific query or request.

 File Manager:
All the files and data structure of the database are managed by this
component.

 Transaction Manager:

It is responsible for making the database consistent before and after


the transactions. Concurrent processes are generally controlled by
this component.

 Buffer Manager:

The transfer of data between primary and main memory and


managing the cache memory is done by the buffer manager.

3.Disk Storage

Following are the components of Disk Manager:

 Data Dictionary:

It contains the metadata (data of data), which means each object of


the database has some information about its structure. So, it creates
a repository which contains the details about the structure of the
database object.

 Data Files

This component stores the data in the files.

 Indices

These indices are used to access and retrieve the data in a very fast
and efficient way.
 TWO-TIER VS THREE-TIER ARCHITECTURE

A two-tier system consists of a server and a client. In a two-tier system,


the database is stored on the server, and the interface installed on the
client is used to access the database.

It is divided into two parts.

1. ) Client Application.

2. ) Database.
The client in a Two-tier architecture application has the code written for
saving data in the database. The client sends a request to the server,
where it then processes the request and sends back the data.

Meaning the client handles both the Presentation layer (application


interface) and Application layer (logical operations), while the server
system handles the database layer.

The Three-tier Architecture is divided into 3 parts.

1. ) Presentation Layer (Client tier)

2. ) Application Layer (Business tier)

3. ) Database Layer (Data tier)

 The Presentation Layer is the topmost layer of an application.


This is the layer seen when using the
software(Interface, web pages). By using the software we access
web pages. Its main function is to communicate with the
application layer. This layer passes information which is given by
the user in terms of keyboard actions and mouse clicks to
the application layer.

 The Application Layer is also known as


the Business logic layer. Here’s where we find logic controls and
functionality that processes data received from the presentation
layer and database layer. It acts as an intermediary between
the presentation and database layer.

 The Database Layer is the layer that stores data with the retrieval
storage and execution methods made by the application layer. It
contains methods that connect to the database and performs the
required actions needed. These are Insert, update or delete. Just to
name a few.

Three-tier Architecture provides the following benefits.

 Scalability :Each tier can scale horizontally. For example, you can
load-balance the Presentation tier among three servers to satisfy more
Web requests without adding servers to the Application and Data
tiers.

 Performance : Because the Presentation tier can cache requests,


network utilization is minimized, and the load is reduced on the
Application and Data tiers. If needed, you can load-balance any tier.

 Availability : If the Application tier server is down and caching is


sufficient, the Presentation tier can process Web requests using the
cache.

 DATA MODELS

1. Hierarchical Data Model:


Hierarchical data model is the oldest type of the data model. It
was developed by IBM in 1968. It organizes data in the tree-like
structure. Hierarchical model consists of the following :

 It contains nodes which are connected by branches.


 The topmost node is called the root node.
 Each node has exactly one parent.
 One parent may have many child.

In the below figure, Electronics is the root node which has two children
i.e. Televisions and Portable Electronics. These two has further
children for which they act as parent. For example: Television has
children as Tube, LCD and Plasma, for these three Television act as
parent. It follows one to many relationship.

2. Network Data Model:

It is the advance version of the hierarchical data model. To organize


data it uses directed graphs instead of the tree-structure. In this child
can have more than one parent. It uses the concept of the two data
structures i.e. Records and Sets.

Figure – Network Data Model

In the above figure, Project is the root node which has two children i.e.
Project 1 and Project 2. Project 1 has 3 children and Project 2 has 2
children. Total there are 5 children i.e Department A, Department B
and Department C, they are network related children as we said that
this model can have more than one parent. So, for the Department B
and Department C have two parents i.e. Project 1 and Project 2.

3. Relational Data Model:

The relational data model was developed by E.F. Codd in 1970. There
are no physical links as they are in the hierarchical data model.
Following are the properties of the relational data model :

 Data is represented in the form of table only.


 It deals only with the data not with the physical structure.
 It provides information regarding metadata.
 At the intersection of row and column there will be only one value
for the tuple.
 It provides a way to handle the queries with ease.

Figure – Relational Data Model


Practice Questions:
1.Define the term:
i. Data
ii. Database
iii. DBMS
iv. Database Instance
v. Schema
2.Explain Data abstraction
3.Explain two level (two-tier) architecture of DBMS
4. Explain three level (three-tier) architecture of DBMS
6.Explain Data Independence.Explain its types
7.Explain advantage of DBMS over file processing system
8.List and explain any six Codd’s rule.
9.List and explain any 6 application of DBMS
10.Explain Data models and its types
11.Explain query processor. List its components
12. Explain storage manager. List its components
13.Draw the overall architecture of DBMS. Explain storage manager and
query processor components.

You might also like