DBMS-UNIT1
DBMS-UNIT1
Introduction:
In computerized information system data is the basic resource of the organization. So, proper
organization and management for data is required fro organization to run smoothly. Database
management system deals the knowledge of how data stored and managed on a computerized
information system. In any organization, it requires accurate and reliable data for better
decision making, ensuring privacy of data and controlling data efficiently.
What is Data?
Data is a collection of raw, unorganised facts and details like text,number, observations,
figures, symbols and descriptions of things etc.
Information:
Information is the processed data on which decisions and actions are based. Information can
be defined as the organized and classified data to provide meaningful values.
File:
File is a collection of related data stored in secondary memory.
The traditional file oriented approach to information processing has for each application a
separate master file and its own set of personal file.
3) Data isolation :
Because data are scattered in various file and files may be in different formats
with new application programs to retrieve the appropriate data is difficult.
4) Integrity Problems:
Developers enforce data validation in the system by adding appropriate code
in the various application program. How ever when new constraints are added,
it is difficult to change the programs to enforce them
1
.
5) Atomicity:
It is difficult to ensure atomicity in a file processing system when transaction
failure occurs due to power failure, networking problems etc.
(atomicity: either all operations of the transaction are reflected properly in the
database or non are)
6) Concurrent access:
In the file processing system it is not possible to access a same file for
transaction at same time
7) Security problems:
There is no security provided in file processing system to secure the data from
unauthorized user access.
Database:
A database is organized collection of related data of an organization stored in formatted way
which is shared by multiple users.
OR
A data base is a collection of logical related data that is organized and recorded in suitable
format.
Function of DBMS:
Defining database schema: it must give facility for defining the database structure
also specifies access rights to authorized users.
Manipulation of the database: The dbms must have functions like insertion of
record into database updation of data, deletion of data, retrieval of data
Sharing of database:The DBMS must share data items for multiple users by
maintaining consistency of data.
Protection of database: It must protect the database against unauthorized users.
Database recovery: If for any reason the system fails DBMS must facilitate data base
recovery.
Advantages of DBMS
1. Data sharing and multiple access: Data must be sharable since different users
present at different physical locations, also a large number of operations may be
common to the different user groups.
2. Data consistency: to process data into useful information. A DBMS allows different
class of users to access and manipulate different portions of data in the database.
3. Reliability: The data base in use should be protected from major failures. A possible
solution will be to backup the entire database at regular intervals.
2
4. Data security: Security is a concept used to protect the data base contents from
accidental damage.
5. Flexibility: The addition of new types of data to a data base causes major changes to
the existing applications then the data base is flexible to change.
6. Integration: If the data base is integrated properly then it is possible for us to share
common and important information which can be shared among different application.
7. Data redundancy: Redundancy is a concept where the same data gets repeated in
various portions of the database due to certain inconsistent operations. Control in
redundancy is the basic necessity of any database.
Why Database:
In order to overcome the limitation of a file system, a new approach was required. Hence a
database approach emerged. A database is a persistent collection of logically related data.
The initial attempts were to provide a centralized collection of data. A database has a self
describing nature. It contains not only the data sharing and integration of data of an
organization in a single database.
A small database can be handled manually but for a large database and having multiple users
it is difficult to maintain it, In that case a computerized database is useful.
Data Independence:
Data independence is usually considered from two points of views; physically data
independence and logical data independence.
Physical data Independence allows changes in the physical storage devices or organization
of the files to be made without requiring changes in the conceptual view or any of the xternal
views and hence in the application programs using the data base.
Logical data independence indicates that the conceptual schema can be changed without
affecting the existing external schema or any application program
3
The database approach is an improvement on the shared file solution as the use of a database
management system (DBMS) provides facilities for querying, data security and integrity,
and allows simultaneous access to data by a number of different users.
End user :- The users who deal with the database at the terminal end they can be
casual users or native database user.
Application programmers- The users who develop the applications in different
languages (Java, .net, Cobol, php etc.) to interact with database.
System Analyst- – System Analyst is responsible for overall technical, economical
and feasibility aspects of the DBMS.
Database administrators- everything related to DBMS like policies and strategies is
handled by the DBA. DBA can be a single person or group of many persons.
Sophisticated Users- They are the SQL programmers, who deal directly with the
database. They write queries to delete/select/insert and update the database.
4
Database Administration :
A person who has central control over the system is called database administrator .
Examples of DBMS
DBMS is widely used by approximately all the companies and there are loads of examples
present there. According to their requirements, large as well as small companies use DBMS
to manage their data. Here are some of the examples of DBMS:
MySQL Database: It was founded in the year 1995. MySQL was acquired by Sun
Microsystems in 2008 and the sun Microsystems was acquired by Oracle after two
years. MySQL is one of the largest open-source companies in the world and is
popular due to its high level of efficiency, reliability and cost.
MS-Access: It was developed by Microsoft and this computer-based application is
used to form as well as create the databases on the desktop of the computers. It can be
used for personal work and for small scale business that required a database. It is easy
as it uses the graphical user interface.
Oracle database: It is the fourth relational database management system which is
developed by Oracle Corporation. Oracle database is useful for storing a large amount
of data, especially by large organizations. Moreover, it is very flexible and very
beneficial for shared SQL and locking.
DB2: It was founded by IBM Corporation and is lucrative to store data for big
industries. It is also a relational database management system and the extended
version of DB2 supports object-oriented features. However, this one is very expensive
that is a big problem.
Microsoft SQL Server: As the name indicates, it is an RDBMS from Microsoft
company which creates computer databases for MS- Windows. Based on customer’s
requirements, Microsoft has developed various versions of SQL Server.
Database Basics:
Data item:
The data item is also called as field in data processing and is the smallest unit of data
that has meaning to its users. Eg: “e101”,”sumit”
6
Data independence
Physical data Independence allows changes in the physical storage devices or organization
of the files to be made without requiring changes in the conceptual view or any of the
external views and hence in the application programs using the data base.
Logical data independence indicates that the conceptual schema can be changed without
affecting the existing external schema or any application program.
A Database stores critical information and helps access data quickly and securely. Therefore,
selecting the correct Architecture of DBMS helps in easy and efficient data management.
1-Tier Architecture
2-Tier Architecture
3-Tier Architecture
1-Tier Architecture
1 Tier Architecture in DBMS is the simplest architecture of Database in which the client,
server, and Database all reside on the same machine. A simple one tier architecture example
would be anytime you install a Database in your system and access it to practice SQL
queries. But such architecture is rarely used in production.
7
2-Tier Architecture
A 2 Tier Architecture in DBMS is a Database architecture where the presentation layer runs
on a client (PC, Mobile, Tablet, etc.), and data is stored on a server called the second tier.
Two tier architecture provides added security to the DBMS as it is not exposed to the end-
user directly. It also provides direct and faster communication.
In the above 2 Tier client-server architecture of database management system, we can see that
one server is connected with clients 1, 2, and 3.
3-Tier Architecture
A 3 Tier Architecture in DBMS is the most popular client server architecture in DBMS in
which the development and maintenance of functional processes, logic, data access, data
storage, and user interface is done independently as separate modules. Three Tier architecture
contains a presentation layer, an application layer, and a database server.
8
The Application layer resides 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.
A schema is a logical data base description(structure of data) and is drawn as a chart of the
types of data that are used . It gives the names of the entities and attributes and specify the
relationships between them.
A subschema is derived schema derived from existing schema as per the user requirement.
There may be more then one subschema create for a single conceptual schema.
The external level is at the highest level of database abstraction . At this level, there will
be many views define for different users requirement. A view will describe only a subset
of the database. Any number of user views may exist for a given global or subschema.
Conceptual level :
At this level of database abstraction all the database entities and the relationships among them
are included . One conceptual view represents the entire database . This conceptual view is
defined by the conceptual schema. The conceptual schema hides the details of physical
storage structures and concentrate on describing entities , data types, relationships, user
operations and constraints.
9
Internal level :
It is the lowest level of abstraction closest to the physical storage method used .
It indicates how the data will be stored and describes the data structures and access
methods to be used by the database . The internal view is expressed by internal schema.
10
o Mapping is used to transform the request and response between various database
levels of architecture.
o Mapping is not good for small DBMS because it takes more time.
o In External / Conceptual mapping, it is necessary to transform the request from
external level to conceptual schema.
o In Conceptual / Internal mapping, DBMS transform the request from the conceptual
to internal level.
The main objective of three level architecture is to enable multiple users to access the same
data with a personalized view while storing the underlying data only once. Thus it separates
the user's view from the physical structure of the database. This separation is desirable for the
following reasons:
1. Internal Level
o The internal level has an internal schema which describes the physical storage
structure of the database.
o The internal schema is also known as a physical schema.
o It uses the physical data model. It is used to define that how the data will be stored in
a block.
o The physical level is used to describe complex low-level data structures in detail.
11
2. Conceptual Level
o The conceptual schema describes the design of a database at the conceptual level.
Conceptual level is also known as logical level.
o The conceptual schema describes the structure of the whole database.
o The conceptual level describes what data are to be stored in the database and also
describes what relationship exists among those data.
o In the conceptual level, internal details such as an implementation of the data structure
are hidden.
o Programmers and database administrators work at this level.
3. External Level
o At the external level, a database contains several schemas that sometimes called as
subschema. The subschema is used to describe the different view of the database.
o An external schema is also known as view schema.
o Each view schema describes the database part that a particular user group is interested
and hides the remaining database from that user group.
o The view schema describes the end user interaction with database systems.
The three levels of DBMS architecture don't exist independently of each other. There must be
correspondence between the three levels i.e. how they actually correspond with each other.
DBMS is responsible for correspondence between the three types of schema. This
correspondence is called Mapping.
The Conceptual/ Internal Mapping lies between the conceptual level and the internal level. Its
role is to define the correspondence between the records and fields of the conceptual level
and files and data structures of the internal level.
The external/Conceptual Mapping lies between the external level and the Conceptual level.
Its role is to define the correspondence between a particular external and the conceptual view.
12
Database Languages in DBMS
o A DBMS has appropriate languages and interfaces to express database queries and updates.
o Database languages can be used to read, store and update the data in the database.
These commands are used to update the database schema that's why they come under Data definition
language.
DML stands for Data Manipulation Language. It is used for accessing and manipulating data in a
database. It handles user requests.
TCL is used to run the changes made by the DML statement. TCL can be grouped into a logical
transaction.
Meta Data
It is a data about data, it includes data of the data types and size etc.,
Meta data stores in a file that is repository OR data dictionary
Database management systems can be classified based on several criteria, such as the data model, user
numbers and database distribution, all described below.
The most popular data model in use today is the relational data model. Well-known DBMSs like
Oracle, MS SQL Server, DB2 and MySQL support this model. Other traditional models, such as
hierarchical data models and network data models, are still used in industry mainly on mainframe
platforms.
14
Classification Based on User Numbers
A DBMS can be classification based on the number of users it supports. It can be a single-user
database system, which supports one user at a time, or a multiuser database system, which supports
multiple users concurrently.
There are four main distribution systems for database systems and these, in turn, can be used to
classify the DBMS.
Centralized systems
With a centralized database system, the DBMS and database are stored at a single site that is used by
several other systems too.
In a distributed database system, the actual database and the DBMS software are distributed from
various sites that are connected by a computer network, as shown in Figure.
Homogeneous distributed database systems use the same DBMS software from multiple sites. Data
exchange between these various sites can be handled easily. For example, library information systems
by the same vendor, use the same DBMS software which allows easy data exchange between the
various library sites.
In a heterogeneous distributed database system, different sites might use different DBMS software,
but there is additional common software to support data exchange between these sites. For example,
the various library database systems use the same machine-readable cataloguing (MARC) format to
support library record data exchange.
16