Computer Organization Study Material R23 Jntuk
Computer Organization Study Material R23 Jntuk
Introduction
Databases and database technology are having a major impact on the growing use
of computers. It is fair to say that database play a critical role in almost all areas where
computers are used, including business, electronic commerce, engineering, medicine,
law, education, and library science, to name a few. The word database is in such
common use that we must begin by defining what a database is.
What is Data
Data is any sort of information which is stored in computer memory. This
information can later be used for a website, an application or any other client to store
for future purpose. The most common information is User information in the form of user
personal, address and banking information.
Let’s consider Facebook, it stores our personal data, images, posts, comments and
many more things.
Banking application also stores user data, their transactions details, funds
summary etc. All this information is data, but when it put together and store in a
structural way, it becomes informational data.
But, how do these applications or websites get data? When you post a status on
Facebook, perform a banking transaction online or upload a selfie on Instagram, you are
actually sending data to the site or to be precise their server. So, we can say any
information transmitted or transferred is actually data. Servers filter out the necessary
data and store it in Database.
What is a Database
A database is a collection of related data, so that it can be easily accessed and managed.
You can organize data into tables, rows, columns, and index it to make it easier to find
Relevant information. Database handlers create a database in such a way that only one
set of software program provides access of data to all the users. The main purpose of the
database is to operate a large amount of information by storing, retrieving, and managing
data.
There are many dynamic websites on the World Wide Web now-a-days which are
handled through databases. For example, consider the names, tele-phone numbers, and
addresses of the people you know. You may have recorded this data in an indexed
address book or you may have stored it on a hard drive, using a personal computer and
software such as Microsoft Access or Excel. This collection of related data with an
implicit meaning is a database.
What is DBMS?
Defining a database involves specifying the data types, structures, and constraints of the
data to be stored in the database. The database definition or descriptive information is
also stored by the DBMS in the form of a database catalog or dictionary; it is called meta-
data.
Constructing the database is the process of storing the data on some storage medium
that is controlled by the DBMS.
Sharing a database allows multiple users and programs to access the database
simultaneously.
An application program accesses the database by sending queries or requests for data to
the DBMS. A query typically causes some data to be retrieved; a transaction may cause
some data to be read and some data to be written into the database.
Other important functions provided by the DBMS include protecting the database and
maintaining it over a long period of time.
A typical large database may have a life cycle of many years, so the DBMS must be able
to maintain the database system by allowing the system to evolve as requirements
change over time.
MySql
Oracle
SQL Server
IBM DB2
PostgreSQL
Amazon SimpleDB (cloud based) etc.
Database Users
For a small personal database one person defines, constructs and manipulates the
database and there is no sharing. In large organizations many people involved in design,
use and maintenance of a large database with hundred of users.
Those who actually use and control the database content and those who design, develop
and maintain database applications called “Actors on the Scene”, and these people
involve the day-to-day use of a large database.
Database Designers
End Users
Casual end user:- These users occasionally access the database, but they may need
different information each time. These users use a sophisticated database query language
to specify their requests.
Ex: through browsers.
Naive or parametric end users:- These users constantly querying and updating the
database.
D.PAVAN KUMAR, Asst.Professor, Tirumala Engineering College. Page 4
DATABASE MANAGEMENT SYSTEMS UNIT-1
Those who design and develop the DBMS software and related tools, and the computer
systems operators called “Workers behind the Scene”. These are the people who are
not interested in the database content itself.
There are three categories: -
Database system designers and implementers.
Tool developers.
1. Database system designers and implementers:- These people will design and
implement the DBMS modules and interfaces as a software package. These will implement
the modules including the implementation of catalog, query processing, interface
processing, buffering data, controlling concurrency, recovery and security.
2. Tool developers:- These people will implement the tools that facilitate database
modelling and design, database system design, and improved performance. Tools are
optional packages that are often purchased separately.
3. Operators and maintenance personnel:- These are responsible for actual running and
maintenance of the hardware and software environment for the database system.
Reduced Redundancy
Data Consistency
Query Language
Security
Transaction processing
1. Data stored into Tables: Data is never directly stored into the database. Data is
stored into tables, created inside the database. DBMS also allows having
relationships between tables which makes the data more meaningful and
connected. You can easily understand what type of data is stored where by looking
at all the tables created in a database.
2. Reduced Redundancy: In the modern world hard drives are very cheap, but earlier
when hard drives were too expensive, unnecessary repetition of data in database
was a big problem. But DBMS follows Normalisation which divides the data in such
a way that repetition is minimum.
3. Data Consistency: Data that is being continuosly updated and added, maintaining
the consistency of data can become a challenge. But DBMS handles it all by itself.
4. Support Multiple user: DBMS allows multiple users to work on it(update, insert,
delete data) at the same time and still manages to maintain the data consistency.
5. Query Language: DBMS provides users with a simple Query language, using which
data can be easily fetched, inserted, deleted and updated in a database.
6. Security: The DBMS also takes care of the security of data, protecting the data
from un-authorized access.
7. Transaction processing: A database management system must include concurrency
control subsystems. This feature ensures that data remains consistent and valid
during transaction processing even if several users update the same information.
The file system provides the details of data DBMS gives an abstract view of data that
representation and storage of data. hides the details
Storing and retrieving of data can't be done DBMS is efficient to use as there are a wide
efficiently in a file system. variety of methods to store and retrieve
data.
It does not offer data recovery processes. There is a backup recovery for data in
DBMS.
The file system doesn't have a crash DBMS provides a crash recovery mechanism
recovery mechanism.
Protecting a file system is very difficult. DBMS offers good protection mechanism.
There is no efficient query processing in the You can easily query data in a database
file system. using the SQL language.
Compared to the File Based Data Management System, Database Management System
has many advantages. Some of these advantages are given below,
Reduction of Redundancies
Data integrity
Data security
Conflict Resolution
Data Administration
Concurrent Access
Crash Recovery
Reduction of Redundancies
Redundancy means duplication (Making the same copy again). Reduction of
redundancy means avoiding duplication of data and reducing the total amount of
storage space required.
It also reduces the extra processing time to search the required data in a large
mass of data.
The conceptual schema provides physical storage details and external schema
provides logical storage details i.e., the conceptual schema provides independence
from external schema. It means physical storage details are independent from
logical storage details.
DBMS strongly provides the efficient access retrieval of the stored information,
including support for very large files, index structures in query optimization.
Data integrity
Data integrity means that the data values entered in the database must be
checked to ensure that they fall within a specified range and are of correct format
(type).
For example, the value for the age of an employee must be in the range of
16 and 55.
Data integrity also checks that if we are referring any field, then that field must
exist. For example, a user is not allowed to transfer funds from a existing savings
account to an non-existent savings account.
Data security
Data is of vital importance to an organization and must be confidential. Such
confidential data must be secured strongly and may not be accessed by any
unauthorized person.
DBA (Database Administrator) should ensure that proper and different access
permissions are given to different types of users. For example, a manager can
access the salary details of employees in his department only.
Conflict Resolution
The DBA should resolve the conflicts among various users to access the same data
file.
The DBA chooses the best file structure and access method to get optimal
performance for using critical applications.
Data Administration
DBMS facilitates maintenance and administration of data by providing a common
base for a large collection of data that is shared by several users.
In addition, the DBA ensures the fine-tuning of data representation periodic back-
ups, ensures proper permissions of data access, monitoring all jobs etc.
Concurrent Access
Many users access a single program concurrently (at the same time) as if their
programs were running in isolation.
The DBMS executes the actions of the program in such a way that the concurrent
access is permitted, but the conflicting operations are not permitted to proceed
concurrently.
Crash Recovery
The DBMS maintain a continuous log (record) of the changes made to the data, so
that, if there is any system crash by power failure, it can restore the database to a
previously stored consistent state.
That is the actions of incomplete transactions are undone, so that the database
stores only the actions of complete transactions after recovery from a crash.
Database applications
Database management systems are used by many individuals either directly or indirectly.
Some of the applications of DBMS are listed below,
Banking
We make thousands of transactions through banks daily and we can do this without going
to the bank. So how banking has become so easy that by sitting at home we can send or
get money through banks. That is all possible just because of DBMS that manages all the
bank transactions.
Telecommunications
Database is used to store the details of number of call made to generate the bill. For
prepaid customers, it stores the available credit.
Online Shopping
These sites store the product information, your addresses and credit details and provide
you the relevant list of products based on your query. All this involves a Database
management system.
Data Models
A data model is a collection of concepts that can be used to describe the structure
of a database. Structure of a database means the data types, relationships that should
hold the data. Most data models also include a set of basic operations for specifying
retrievals and data updating.
Other operations like insert, delete, modify or retrieve any kind of object are often
included in the basic data model operations. Basically there are two types of data
models.
Relationship: Relationship tells how two attributes are related. Example: Teacher
works for a department.
In the above diagram, the entities are Teacher and Department. The attributes of
Teacher entity are Teacher_Name, Teacher_id, Age, Salary and Mobile_Number. The
attributes of entity Department entity are Dept_id, Dept_name. The two entities are
connected using the relationship. Here, each teacher works for a department.
b) Object oriented model: - Like E-R model, this model also models a database as a
collection of objects. An object body encapsulates data (variables) as well as methods
(functions) to manipulate the data. The objects that contain same type of data and same
type of functions are generated together a class. So class is a type definition for proposed
objects. The only way an object ‘A’ can access the data items of another object ‘B’ is by
invoking the methods of ‘B’. ‘A’ can reach this by making method calls to ‘B’ through B’s
interface.
The structure of object oriented database is method as a set of classes and database will
comprise objects belonging to those classes.
2.Record based logical models:- These models describes data at the logical level. In
these models data is stored as collection of records of different types. Each record type
can have a fixed number of fields and each field is usually of fixed length.
a) Hierarchical Model: Hierarchical Model was the first DBMS model. This model
organizes the data in the hierarchical tree structure. The hierarchy starts from the root
which has root data and then it expands in the form of a tree adding child node to the
parent node. This model easily represents some of the real-world relationships like food
recipes, sitemap of a website etc. for example; one department can have many courses,
many professors and off-course many students.
b) Network Model: This model is an extension of the hierarchical model. It was the most
popular model before the relational model. This model is the same as the hierarchical
model; the only difference is that a record can have more than one parent. It replaces
the hierarchical tree with a graph.
Example: In the example below we can see that node student has two parents i.e. CSE
Department and Library. This was earlier not possible in the hierarchical model.
c) Relational Model: Relational Model is the most widely used model. In this model, the
data is maintained in the form of a two-dimensional table. All the information is stored in
the form of row and columns. The basic structure of a relational model is tables. So, the
tables are also called relations in the relational model.
Example: In this example, we have an Employee table.
Concepts of Schema
The design of a database at physical level is called physical schema, how the data stored
in blocks of storage is described at this level.
Design of database at 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).
Design of database at view level is called view schema. This generally describes end user
interaction with database systems.
Concepts of Instance
Data abstraction:- Abstraction is nothing but hiding complex details and exposing the
essential things. Database developers hide internal complexity through several levels of
abstraction.
The goal of the three-schema architecture, is to separate the user applications from the
physical database. The data abstracted at each of these levels is described by a word
schema. A schema means a plan that explains the records and relationships existing
between them, at each level.
Data Independence
The three-schema architecture can be used to further explain the concept of data
independence, which can be defined as the capacity to change the schema at one level
of a database system without having to change the schema at the next higher level. We
can define two types of data independence:
Physical data independence is the capacity to change the internal schema without
having to change the conceptual schema. Hence, the external schemas need not be
changed as well. Changes to the internal schema may be needed because some physical
files were reorganized.
Database Management System (DBMS) is a software that allows access to data stored in a
database and provides an easy and effective method of –
The database system is divided into three components: Query Processor, Storage
Manager, and Disk Storage. These are explained as following below.
1.Query Processor:
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.
DML Compiler
It processes the DML statements into low level instruction (machine language), so
that they can be executed.
DDL Interpreter
It processes the DDL statements into a set of tables containing meta data (data
about data).
Embedded DML Pre-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. It
maintains the consistency and integrity of the database by applying the constraints and
executes the DCL statements. It is responsible for updating, storing, deleting, and
retrieving data in the database.
It contains the following components –
Authorization Manager
It ensures role-based access control, i.e.. checks whether the particular person is
privileged to perform the requested operation or not.
Integrity Manager
File Manager
It manages the file space and the data structure used to represent information in the
database.
Buffer Manager
It is responsible for cache memory and the transfer of data between the secondary
storage and main memory.
3. Disk Storage:
Data Files –
Data Dictionary
It contains the information about the structure of any database object. It is the
repository of information that governs the metadata.
Indices
The term database system refers to the components of an organization that defines and
regulate the collection, storage, management and use of data within a database
environment. The database management system can be divided into five major
components, they are:
Hardware
Software
Data
Procedures
Database Access Language
Hardware
When we say Hardware, we mean computer, hard disks, I/O channels for data, and any
other physical component involved before any data is successfully stored into the
memory.
When we run Oracle or MySQL on our personal computer, then our computer's Hard Disk,
our Keyboard using which we type in all the commands, our computer's RAM, ROM all
become a part of the DBMS hardware.
Software
This is the main component, as this is the program which controls everything. The DBMS
software is more like a wrapper around the physical database, which provides us with an
easy-to-use interface to store, access and update data.
The DBMS software is capable of understanding the Database Access Language and
interpret it into actual database commands to execute them on the DB.
Data
Data is that resource, for which DBMS was designed. The motive behind the creation of
DBMS was to store and utilize data.
In a typical Database, the user saved Data is present and Meta data is stored.
Metadata is data about the data. This is information stored by the DBMS to better
understand the data stored in it.
For example: When I store my Name in a database, the DBMS will store when the name
was stored in the database, what is the size of the name, is it stored as related data to
some other data, or is it independent, all this information is metadata.
Procedures
A user can write commands in the Database Access Language and submit it to the DBMS
for execution, which is then translated and executed by the DBMS.
User can create new databases, tables, insert data, fetch stored data, update data and
delete the data using the access language.
Centralized and Client Server architecture for the database classified into four
different types:
Earlier architectures used mainframe computers to provide the main processing for
all system functions, including user application programs and user interface programs, as
well as all the DBMS functionality. The reason was that most users accessed such systems
via computer terminals that did not have processing power and only provided display
capabilities. Therefore, all processing was performed remotely on the computer system,
and only display information and controls were sent from the computer to the display
terminals, which were connected to the central computer via various types of
communications networks.
Most users replaced their terminals with PCs and workstations. At first, database
systems used these computers similarly to how they had used display terminals, so that
the DBMS itself was still a centralized DBMS in which all the DBMS functionality,
application program execution, and user inter-face processing were carried out on one
machine. Figure illustrates the physical components in a centralized architecture.
Gradually, DBMS systems started to exploit the available processing power at the user
side, which led to client/server DBMS architectures.
The client machines provide the user with the appropriate interfaces to utilize
these servers, as well as with local processing power to run local applications. This
concept can be carried over to other software packages, with specialized programs such
as a CAD (computer-aided design) package being stored on specific server machines and
being made accessible to multiple clients.
A client in this framework is typically a user machine that provides user interface
capabilities and local processing. When a client requires access to additional
functionality— such as database access—that does not exist at that machine, it connects
to a server that provides the needed functionality.
A server is a system containing both hard-ware and software that can provide
services to the client machines, such as file access, printing, archiving, or database
access. In general, some machines install only client software, others only server
software, and still others may include both client and server software.
language for RDBMSs, this created a logical dividing point between client and server.
Hence, the query and transaction functionality related to SQL processing remained on the
server side. The server is often called a query server or transaction server because it
provides these two functionalities.
The user interface programs and application programs can run on the client side.
When DBMS access is required, the program establishes a connection to the DBMS (which
is on the server side); once the connection is created, the client program can
communicate with the DBMS. A standard called Open Database Connectivity
For example, the server level may include the part of the DBMS software
responsible for handling data storage on disk pages, local concurrency control and
recovery, buffering and caching of disk pages, and other such functions.
The client level may handle the user interface; data dictionary functions; DBMS
interactions with programming language compilers; global query optimization,
concurrency control, and recovery across multiple servers; structuring of complex objects
from the data in the buffers; and other such functions.
The architectures described here are called two-tier architectures because the
soft-ware components are distributed over two systems: client and server.
This intermediate layer or middle tier is called the application server or the Web
server, depending on the application. This server plays an intermediary role by running
application programs and storing business rules (procedures or constraints) that are used
to access data from the database server.
Figure (b) shows another architecture used by database and other application
package vendors. The presentation layer displays information to the user and allows data
entry. The business logic layer handles intermediate rules and constraints before data is
passed up to the user or down to the DBMS. The bottom layer includes all data
management services. The middle layer can also act as a Web server, which retrieves
query results from the database server and formats them into dynamic Web pages that
are viewed by the Web browser at the client side.
Creates and maintain all databases required for development and testing.
Performs ongoing tuning of the database instances.
Install new versions of the oracle DBMS and its tools and any other tools that
access the oracle database.
Planes and implements backup and recovery the oracle database.
Control’s migrations of programs, database changes, reference data changes
through the development life cycle.
History of DBMS
Data is a collection of facts and figures. The data collection was increasing day to
day and they needed to be stored in a device or a software which is safer.
Charles Bachman was the first person to develop the Integrated Data Store (IDS)
which was based on network data model for which he was inaugurated with the Turing
Award. It was developed in early 1960’s.
The relational model was still in use by many people in the market. Later during
the same decade (1980’s), IBM developed the Structured Query Language (SQL) as a
part of R project. It was declared as a standard language for the queries by ISO and
ANSI.
Further, there were many other models with rich features like complex queries,
datatypes to insert images and many others. The Internet Age has perhaps influenced the
data models much more. Data models were developed using object-oriented programming
features, embedding with scripting languages like Hyper Text Markup Language (HTML)
for queries.
DBMS languages
Database languages are used to read, update and store data in a database. There
are several such languages that can be used for this purpose; one of them is SQL
(Structured Query Language).
The following are the databases languages in the database management system:
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.
database, insert new data into the database, and delete the existing data from the
database.
Select: This command is used to retrieve or access the data from the database
table.
Insert: This command is used to insert the records into the table.
Update: This command is used to change/update the existing data in a table.
Delete: This command is used to delete one or all the existing records from the
table.
DCL is used to access the stored or saved data. It is mainly used for revoking and
granting user access on a database. In the Oracle database, this language does not have
the feature of rollback. It is a part of SQL.