DBMS Unit 1 Notes
DBMS Unit 1 Notes
BCA 501
Faculty:
Mr. Munish Sharma
1
Objectives
• Basic Definitions
• Typical DBMS Functionality
• Example of a Database (UNIVERSITY)
• Main Characteristics of the Database Approach
• Database Users
• Advantages of Using the Database Approach
• When Not to Use Databases
• Recent database applications
Introduction
• Data can be stored in normal text or binary files
• As data grows, and applications need to manipulate data in complex ways, this
simplistic approach of storing data may not be sufficient
• Databases allow us to manipulate and store data in an organized way, and hence
transform data into meaningful information
• In today’s world, a database is an integral part of any application
What is a Database?
8
Basic Definitions
• Data
– Facts that can be recorded and that have implicit meaning
• Database
– Collection of related data
• Database system
– Database and DBMS software together
Typical DBMS Functionality
• DBMS is a general-purpose software system that facilitates the processes of
defining, constructing, manipulating, and sharing databases among various users
and applications
• Defining a database - specifying the data types, structures, and constraints of the data to be
stored in the database
• Constructing the database - process of storing the data on some storage medium that is
controlled by the DBMS
• Manipulating a database - functions such as querying the database to retrieve specific data,
updating the database to reflect changes, and generating reports from the data
• Sharing a database - allows multiple users and programs to access the database simultaneously
Simplified Database System Environment
Example of a Database
• Mini-world for the example
– UNIVERSITY database for maintaining information concerning students, courses, and
grades in a university environment
2. Database Designers
– responsible for identifying the data to be stored in the database and for choosing appropriate
structures to represent and store this data
– mostly undertaken before the database is actually implemented and populated with data
– must communicate with the end-users and understand their needs
– the final database design must be capable of supporting the requirements of all user groups
Actors on the Scene contd.
3. End users
– people whose jobs require access to the database for querying, updating, and generating reports;
the database primarily exists for their use
– categories of end users
Casual end users
Naive or parametric end users
Sophisticated end users
Standalone users
• It may be more desirable to use regular files under the following circumstances
– Simple, well-defined database applications that are not expected to change at all
– Stringent, real-time requirements for some application programs that may not be met because of
DBMS overhead
– No multiple-user access to data
Recent Database Applications
• Scientific applications that store large amounts of data resulting from scientific
experiments in areas such as
– high-energy physics
– mapping of the human genome
– discovery of protein structures
The earliest business computer systems were used to process business records and
produce information. They were generally faster and more accurate than equivalent
manual systems. These systems stored groups of records in separate files, and so they
were called file processing systems.
– File system is a collection of data. Any management with the file system, user has
to write the procedures
– File system gives the details of the data representation and Storage of data.
– In File system storing and retrieving of data cannot be done efficiently.
– Concurrent access to the data in the file system has many problems like a
Reading the file while other deleting some information, updating some
information
•
23
– File system doesn’t provide crash recovery mechanism.
Eg. While we are entering some data into the file if System crashes then content of the
file is lost.
24
DISADVANTAGES OF FILE-ORIENTED SYSTEM:
The following are the disadvantages of File-Oriented System:
Data Redundancy and Inconsistency:
Since files and application programs are created by different programmers over a long
period of time, the files are likely to be having different formats and the programs may
be written in several programming languages. Moreover, the same piece of information
may be duplicated in several places. This redundancy leads to higher storage and
access cost. In addition, it may lead to data inconsistency.
Difficulty in Accessing Data:
The conventional file processing environments do not allow needed data to be
retrieved in a convenient and efficient manner. Better data retrieval system must be
developed for general use.
25
Data Isolation:
Since data is scattered in various files, and files may be in different formats, it is
difficult to write new application programs to retrieve the appropriate data.
Security Problems:
Not every user of the database system should be able to access all the data. For
example, in banking system, payroll personnel need only that part of the database that
has information about various bank employees. They do not need access to
information about customer accounts. It is difficult to enforce such security constraints.
26
Integrity Problems:The data values stored in the database must satisfy certain types of
consistency constraints. For example, the balance of a bank account may never fall
below a prescribed amount. These constraints are enforced in the system by adding
appropriate code in the various application programs. When new constraints are
added, it is difficult to change the programs to enforce them. The problem is
compounded when constraints involve several data items for different files.
Atomicity Problem:
A computer system like any other mechanical or electrical device is subject to failure. In
many applications, it is crucial to ensure that once a failure has occurred and has been
detected, the data are restored to the consistent state existed prior to the failure
27
The Evolution of Database systems:
28
DBMS Database Models
29
File Management System:
The file management system also called as FMS in short is one in which all data is stored on a
single large file. The main disadvantage in this system is searching a record or data takes a long
time. This lead to the introduction of the concept, of indexing in this system. Then also the FMS
system had lot of drawbacks to name a few like updating or modifications to the data cannot
be handled easily, sorting the records took long time and so on. All these drawbacks led to the
introduction of the Hierarchical Database System.
Hierarchical Database System:
The previous system FMS drawback of accessing records and sorting records which took a long
time was removed in this by the introduction of parent-child relationship between records in
database. The origin of the data is called the root from which several branches have data at
different levels and the last level is called the leaf. The main drawback in this was if there is any
modification or addition made to the structure then the whole structure needed alteration
which made the task a tedious one. In order to avoid this next system took its origin which is
called as the Network Database System.
30
31
Network Database System:
In this the main concept of many-many relationships got introduced. But this also
followed the same technology of pointers to define relationships with a difference in
this made in the introduction if grouping of data items as sets.
32
Relational Database System:
In order to overcome all the drawbacks of the previous systems, the Relational
Database System got introduced in which data get organized as tables and each record
forms a row with many fields or attributes in it. Relationships between tables are also
formed in this system.
33
Data Independence in DBMS: Physical & Logical
with Examples
What is Data Independence of DBMS?
• Data Independence is defined as a property of DBMS that helps you to change the
Database schema at one level of a database system without requiring to change the
schema at the next higher level. Data independence helps you to keep data
separated from all programs that make use of it.
• You can use this stored data for computing and presentation. In many systems, data
independence is an essential function for components of the system.
34
Types of Data Independence
In DBMS there are two types of data independence
Physical data independence
Logical data independence.
Levels of Database
Before we learn Data Independence, a refresher on Database Levels is
important. The database has 3 levels as shown in the diagram below
Physical/Internal
Conceptual
External
35
Levels of DBMS Architecture Diagram
36
Consider an Example of a University Database. At the different levels this is how the
implementation will look like:
Conceptual Shema Students(id: int, name: string, login: string, age: integer)
Courses(id: int, cname.string, credits:integer)
Enrolled(id: int, grade:string)
37
• Physical Data Independence
• Physical data independence helps you to separate conceptual levels from the
internal/physical levels. It allows you to provide a logical description of the database
without the need to specify physical structures. Compared to Logical Independence,
it is easy to achieve physical data independence.
• With Physical independence, you can easily change the physical storage structures
or devices with an effect on the conceptual schema. Any change done would be
absorbed by the mapping between the conceptual and internal levels. Physical data
independence is achieved by the presence of the internal level of the database and
then the transformation from the conceptual level of the database to the internal
level.
38
• Examples of changes under Physical Data Independence
• Due to Physical independence, any of the below change will not affect the
conceptual layer.
• Using a new storage device like Hard Drive or Magnetic Tapes
• Modifying the file organization technique in the Database
• Switching to different data structures.
• Changing the access method.
• Modifying indexes.
• Changes to compression techniques or hashing algorithms.
• Change of Location of Database from say C drive to D Drive
39
Logical Data Independence
• Logical Data Independence is the ability to change the conceptual scheme without
changing
• External views
• External API or programs
• Any change made will be absorbed by the mapping between external and
conceptual levels.
• When compared to Physical Data independence, it is challenging to achieve logical
data independence.
40
Examples of changes under Logical Data Independence
• Due to Logical independence, any of the below change will not affect the external
layer.
• Add/Modify/Delete a new attribute, entity or relationship is possible without a
rewrite of existing application programs
• Merging two records into one
• Breaking an existing record into two or more records
41
Difference between Physical an Logical Data Independence
Logica Data Independence Physical Data Independence
Logical Data Independence is mainly concerned with the structure or changing Mainly concerned with the storage of the data.
the data definition.
It is difficult as the retrieving of data is mainly dependent on the logical It is easy to retrieve.
structure of data.
Compared to Logic Physical independence it is difficult to achieve logical data Compared to Logical Independence it is easy to achieve physical data
independence. independence.
You need to make changes in the Application program if new fields are added A change in the physical level usually does not need change at the Application
or deleted from the database. program level.
Modification at the logical levels is significant whenever the logical structures Modifications made at the internal levels may or may not be needed to improve
of the database are changed. the performance of the structure.
Example: Add/Modify/Delete a new attribute Example: change in compression techniques, hashing algorithms, storage
devices, etc
42
Importance of Data Independence
44
1 tier Architecture
45
2-tier Architecture
• A two-tier architecture is a database architecture where
• Presentation layer runs on a client (PC, Mobile, Tablet, etc)
• Data is stored on a Server.
• An application interface which is called ODBC (Open Database Connectivity) an API
which allows the client-side program to call the DBMS. Today most of the DBMS
offers ODBC drivers for their DBMS. 2 tier architecture provides added security to
the DBMS as it is not exposed to the end user directly.
• Example of Two-tier Architecture is a Contact Management System created using
MS- Access.
46
In the above 2-teir architecture we can see that one server is connected with clients 1, 2m and 3. This
architecture provides Direct and faster communication.
47
3-tier Architecture
48
This DBMS architecture contains an Application layer between the user and the DBMS, which is responsible for
communicating the user's request to the DBMS system and send the response from the DBMS to the user.
The application layer(business logic layer) also processes functional logic, constraint, and rules before passing data to the
user or down to the DBMS
Three tier architecture is the most popular DBMS architecture.
The goal of Three-teir architecture is:
To separate the user applications and physical database
Proposed to support DBMS characteristics
Program-data independence
Support of multiple views of the data
Example of Three-teir Architecture
Any large website on the internet.
49
Summary
• Database is a collection of related data, where data means recorded facts
• A typical database represents some aspect of the real world and is used for specific
purposes by one or more groups of users
• A DBMS is a generalized software package for implementing and maintaining a
computerized database
• The database and software together form a database system
• Main categories of database users are actors on the scene and behind the scene
• Traditional database applications were based on the text or numeric data