0% found this document useful (0 votes)
15 views44 pages

DBMS1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views44 pages

DBMS1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

Database

Technologies

Compiled By: Pankaj Kumar Bahety


Definition: Data consists of a series of facts or statements that
may have been collected, stored, processed and/or manipulated
but have not been organized or placed into context. When data is
organized, it becomes information. Information can be processed
and used to draw generalized conclusions or knowledge.

Compiled By: Pankaj Kumar Bahety


Uses of data in computing

Raw data are numbers, characters, images or other outputs from


devices to convert physical quantities into symbols, in a very
broad sense. Such data are typically further processed by a human
or input into a computer, stored and processed there, or
transmitted (output ) to another human or computer. Raw data is a
relative term; data processing commonly occurs by stages, and
the "processed data" from one stage may be considered the "raw
data" of the next.

Compiled By: Pankaj Kumar Bahety


Definition: A database is a collection of information organized
into interrelated tables of data and specifications of data objects.
Description.

Compiled By: Pankaj Kumar Bahety


Database
Management
System
Compiled By: Pankaj Kumar Bahety
Database Management System :
A DBMS can be an extremely complex set of software programs
that controls the organization, storage and retrieval of data
(fields, records and files) in a database. It also controls the
security and integrity of the database. The DBMS accepts
requests for data from the application program and instructs the
operating system to transfer the appropriate data.

Compiled By: Pankaj Kumar Bahety


What is a Database Management System ?

 A database Management system consist of a collection of


interrelated data and a set of programs to access those data.

 The objective of DBMS is to provide a convenient and


effective method of defining, storing and retrieving the
information contained in the Database.
 DBMS exerts centralized control of database prevents
unauthorized users from accessing the data and ensure
privacy of data.
 A database Management system provides for the safety
of information stored despite system crashes.

Compiled By: Pankaj Kumar Bahety


What was the need of Database Management System ?

Compiled By: Pankaj Kumar Bahety


Conventional File System

 Store Data in permanent System Files

 Data Redundancy and Inconsistency


• More and more system files are added
• Duplication of information
• Higher storage and access cost
• Data inconsistency due to multiple copies

 Difficulty in accessing Data


• Querying the data stored difficult
• Each time new query
• New application program always
•Manual search
Compiledmost of Kumar
By: Pankaj the time
Bahety
Conventional File System

 Data Isolation
• Scattered in various Files
• Files may be in different format
• Difficult write new application programs
• Multi skilled system programmer is needed

 Integrity Problems
• Programs are written to enforce integrity constraints
•Difficult add new constraints
• Specifically when constraints involve data items from
different files.

Compiled By: Pankaj Kumar Bahety


Conventional File System

 Atomicity Problem.

• Data consistency in case of system failure


• Either transaction happens completely or not at all
• Difficult to ensure the consistency
 Concurrent access anomalies
• Multiple users are permitted to access data
•Concurrent update leads to inconsistency
• Supervision of this activity is difficult.
 Security problems
•Access Restriction
•Every time application programs are needed
• Difficult enforce security constraints
Compiled By: Pankaj Kumar Bahety
What are the advantages of DBMS ?

Compiled By: Pankaj Kumar Bahety


Advantages of DBMS

 Reduction of Data Redundancy


• Centralized control of DBA avoids unnecessary
duplication.
• Reduces the total amount of Data storage required
• Reduces the search time to locate data
• If any redundancies system ensure the multiple copies
are consistent
 Shared Data
•Allows sharing of data
• Any number application programs or Users

Compiled By: Pankaj Kumar Bahety


Advantages of DBMS

 Integrity
• Centralized control ensure that adequate checks are
incorporated.
• Referential integrity
 Security
• Data access permission
• Authentication schemes
• Levels of security can be implemented

Compiled By: Pankaj Kumar Bahety


Advantages of DBMS

 Conflict Resolutions

 Data Independence

Compiled By: Pankaj Kumar Bahety


DBA

Centralized control of the DB is exerted by a person or group of


persons under the supervision of a high level administrator. This
person or group is referred as database administrator.

Functions of DBA
Schema Definition
 DBA custodian of data and controls the database structure.
Storage structure and access method definition
Create appropriate storage structure and access methods by
writing a set of definitions. Which are translated by data storage
and data definition compiler.
Compiled By: Pankaj Kumar Bahety
DBA

Schema and Physical organization modification


 Changes in the levels of database.
Granting authorization for data access
Granting permission to users
 Stores profile of each user
 This profile is used for access verification
Integrity constraint specification
Ensuring the appropriate measures for the data integrity
 Whenever an access of data is attempted this would be
consulted

Compiled By: Pankaj Kumar Bahety


Database application:

A database application is a type of computer application


dedicated to managing a database. Database applications span a
huge variety of needs and purposes, from small user-oriented
tools such as an address book, to huge enterprise-wide systems
for tasks like accounting.
The term "database application" usually refers to software
providing a user interface to a database. The software that
actually manages the data is usually called a Database
Management System (DBMS) or (if it is embedded) a database
engine.
Examples of database applications include MySQL, Microsoft
Access, Oracle, Informix, Sybase etc.

Compiled By: Pankaj Kumar Bahety


A data model is a model that describes in an abstract way how
data is represented in an information system or a database..
In general it describes the following aspects:

Structure: defines what the structure of the representation is.


This should not only specify how data is represented but
also how a schema can be specified that defines the
structure of the data in a specific user domain.

Compiled By: Pankaj Kumar Bahety


Integrity: provides a language for the definition of rules that
restrict which instances of the defined structure are allowed.

Manipulation: provides a language in which updates of the data


can be expressed.

Querying: provides a language in which the data can be queried.

An example is the relational model in which all data is represented


by mathematical relations (or, to be precise, a slightly generalized
version thereof). It furthermore defines a set of specific constraints
(candidate keys, foreign keys) and a general language for
specifying constraints (first-order logic), and for manipulations
and querying the data the relational algebra,, tupule calculus and
domain calculus are introduced.

Compiled By: Pankaj Kumar Bahety


Types Of Traditional Data
Models :
1.Hierarchal
2.Network
3.Relational

Compiled By: Pankaj Kumar Bahety


D a ta M o d e ls

H ie r a r c h ie l D a ta M o d e l :

T h e H ie r a r c h ie l m o d e l r e la te s e n t it ie s b y p a r e n t / c h ild o r s u p e r io r / s u b o r d in a te r e la t io n s h ip . e .g
.A n o r g a n iz a t io n c h a r t . G r a p h ic a lly t h e h ie r a r c h ie l m o d e l is s h o w n a s a n I n v e r te d t r e e , w it h t h e
h ig h e s t le v e l o f t h e t r e e k n o w n a s th e r o o t . T h e n o d e s o f th e t r e e r e p r e s e n ts e n t it ie s .

H ie r a r c h ie l M o d e l p e r m its tw o t y p e s o f r e la t io n s h ip s .
O n e to O n e
O n e to M a n y

Compiled By: Pankaj Kumar Bahety


A hierarchical database is a kind of DBMS that links records
together in a tree data structure such that each record type has only
one owner, e.g. an order is owned by only one customer.
Hierarchical structures were widely used in the first mainframe
database management systems. However, due to their restrictions,
they often cannot be used to relate structures that exist in the real
world.
Hierarchical relationships between different types of data can make
it very easy to answer some questions, but very difficult to answer
others. If one-to-many relationship is violated (e.g., a patient can
have more than one physician) then the hierarchy becomes a
network.

Compiled By: Pankaj Kumar Bahety


Terms Used

•Field - smallest unit of data


•Segment - groups of fields; nodes of the tree structure
•Data base record - a collection of related segments; a
particular tree structure
•Data base - composed of database records
•Data base description - how data base records are
defined; set of assembly-language macro instructions
•Root - first segment
•Sequence field - one field in each segment used to order
the occurrences of a given type

Compiled By: Pankaj Kumar Bahety


Some Hierarchal DBMS :
Adabas is an inverted list database management system owned
by Software AG. It is used in applications that require very high
volumes of data processing or in OLAP.

IMS began as a hierarchical database designed by IMS for


Rockwell for the Appolo Programs. It was used to track the bill
of materials for the Saturn V.
IMS is still running thirty five years later and over time has seen
some interesting developments as IBM S/360 technology
developed into the current z/OS operating system.

Compiled By: Pankaj Kumar Bahety


A network model DBMS has a more flexible structure than the
Hierarchal model , but pays for it in processing time and
specialization of types. Some Object –Oriented Database systems
use a general network model, but most have some hierarchal
limitations.
The neural network is an important modern example of a network
database - a large number of similar simple processing units,
analogous to neurons in the human brain, 'learn' the differences
and similarities between a number of inputs. At any one time the
'weights' assigned to different connections between layers of
neuron-like processing units constitute a set of assertions about
what is most closely related to what.

Compiled By: Pankaj Kumar Bahety


N e tw o r k D a ta M o d e l

T h e n e tw o r k d a ta m o d e l is s i m ila r to th e h e r a r c h ie l m o d e l , e x c e p t t h a t a n
e n t it y c a n h a v e m o r e th a n o n e p a r e n t .

G r a p h ic a lly it is r e p r e s e n te d a s a n a r b it r a r y g r a p h . I t p e r m its a ll t y p e s o f
r e la t io n s h ip s . Compiled By: Pankaj Kumar Bahety
The relational model for management of a database is a data
model based on predicate and set theory .
The relational model was the first formal database model. After it
was defined, formal models were made to describe hierarchical
databases (the hierarchical model,) and network databases (the
network model). Hierarchical and network databases existed
before relational databases, but were only given formal models
after the relational model was defined.
The relational model was invented by Dr. Ted Codd and
subsequently maintained and developed by Chris Dateand Hugh
Darwen ,, as a general model of data. In The Third Manifesto
(1995) they show how the relational model can be extended with
object oriented features without compromising its fundamental
principles.

Compiled By: Pankaj Kumar Bahety


The standard language for relational databases, SQL, is only
vaguely reminiscent of the mathematical model. Usually it is
adopted, despite its restrictions, because it is far and away more
popular than any other database language.
The fundamental assumption of the relational model is that all
data is represented as mathematical relational, i.e., a subset of
the Cartesian product of n sets. In the mathematical model
(unlike SQL), reasoning about such data is done in two-valued
predicate logic (that is, without a null value), meaning there are
two possible evolutions for each proposition: either true or false.
The data is operated upon by means of a relational calculus and
algebra.

Compiled By: Pankaj Kumar Bahety


The relational data model permits the designer to create a
consistent logical model of the information to be stored. This
logical model can be refined through a process of database
normalization. A database built on the pure relational model
would be entirely normalized. The access plans and other
implementation and operation details are handled by the DBMS
engine, and should not be reflected in the logical model. This
contrasts with common practice for SQL DBMSs in which
performance tuning often requires changes to the logical model.

Compiled By: Pankaj Kumar Bahety


R e la t io n a l D a ta M o d e l :

T h e R e la t io n a l d a ta m o d e l is c u rre n t ly t h e m o s t p o p u la r in D B M S , b e c a u s e
it is c o n c e p t u a lly s im p le a n d u n d e rs ta n d a b le b y in fo r m a t io n s y s te m s
p ro fe s s io n a ls . It u s e s d a ta v a lu e s to i m p ly re la t io n s h ip s . A re la t io n a l d a ta
m o d e l is b a s e d o n a re la t io n , a tw o d im e n s io n a l ta b le . R o w s re p re s e n t in g
re c o rd s a n d c o lu m n s s h o w t h e a tt r ib u te s o f t h e e n t it y .

E m p no N ame A d d re s s D e p a rt m e n t B a s ic

Compiled By: Pankaj Kumar Bahety


The basic relational building block is the domain, or datatype. A
tuple is a set of attributes, which are ordered pairs of domain
and value. A relvar (relation variable) is an unordered set of
ordered pairs of domain and name, which serves as the header
for a relation. A relation is an unordered set of tuples. Although
these relational concepts are mathematically defined, they
correspond loosely to traditional database concepts. A relation is
similar to the traditional concept of table. A tuple is similar to
the concept of row.
The basic principle of the relational model is the information is
represented by data values in relations. Thus, the relvars are not
related to each other at domain in several relvars, and if one
attribute is dependent on another, this dependencyis enforced
through referential integrity .

Compiled By: Pankaj Kumar Bahety


Relational Database Design
When designing a database, you have to make decisions
regarding how best to take some system in the real world
and model it in a database. This consists of deciding which
tables to create, what columns they will contain, as well as
the relationships between the tables. While it would be nice
if this process was totally intuitive and obvious, or even
better automated, this is simply not the case. A well-
designed database takes time and effort to conceive, build
and refine.

Compiled By: Pankaj Kumar Bahety


The benefits of a database that has been designed
according to the relational model are numerous. Some of
them are:
 Data entry, updates and deletions will be efficient.
 Data retrieval, summarization and reporting will also
be efficient.
 Since the database follows a well-formulated model,
it behaves predictably.
 Since much of the information is stored in the
database rather than in the application, the database is
somewhat self-documenting.
 Changes to the database schema are easy to make.

Compiled By: Pankaj Kumar Bahety


Tables, Uniqueness and Keys
Tables in the relational model are used to represent "things"
in the real world. Each table should represent only one thing.
These things (or entities) can be real-world objects or
events. For example, a real-world object might be a
customer, an inventory item, or an invoice. Examples of
events include patient visits, orders, and telephone calls.
Tables are made up of rows and columns.

Compiled By: Pankaj Kumar Bahety


The relational model dictates that each row in a table be
unique. If you allow duplicate rows in a table, then there's no
way to uniquely address a given row via programming. This
creates all sorts of ambiguities and problems that are best
avoided. You guarantee uniqueness for a table by
designating a primary key—a column that contains unique
values for a table. Each table can have only one primary
key, even though several columns or combination of
columns may contain unique values. All columns (or
combination of columns) in a table with unique values are
referred to as candidate keys, from which the primary key
must be drawn. All other candidate key columns are referred
to as alternate keys. Keys can be simple or composite. A
simple key is a key made up of one column, whereas a
composite key is made up of two or more columns.
Compiled By: Pankaj Kumar Bahety
The decision as to which candidate key is the primary one
rests in your hands—there's no absolute rule as to which
candidate key is best. The decision should be based upon
the principles of minimality (choose the fewest columns
necessary), stability (choose a key that seldom changes),
and simplicity/familiarity (choose a key that is both simple
and familiar to users).

Compiled By: Pankaj Kumar Bahety


Compiled By: Pankaj Kumar Bahety
Foreign Keys and Domains
Although primary keys are a function of individual tables, if
you created databases that consisted of only independent
and unrelated tables, you'd have little need for them.
Primary keys become essential, however, when you start
to create relationships that join together multiple tables in a
database. A foreign key is a column in a table used to
reference a primary key in another table.

Compiled By: Pankaj Kumar Bahety


Compiled By: Pankaj Kumar Bahety
Relationships
You define foreign keys in a database to model relationships
in the real world. Relationships between real-world entities
can be quite complex, involving numerous entities each
having multiple relationships with each other. For example, a
family has multiple relationships between multiple people—
all at the same time. In a relational database such as Oracle,
however, you consider only relationships between pairs of
tables. These tables can be related in one of three different
ways: one-to-one, one-to-many or many-to-many.

Compiled By: Pankaj Kumar Bahety


One-to-One Relationships
Two tables are related in a one-to-one (1—1) relationship if,
for every row in the first table, there is at most one row in the
second table. True one-to-one relationships seldom occur in
the real world. This type of relationship is often created to get
around some limitation of the database management
software rather than to model a real-world situation.
One-to-Many Relationships
Two tables are related in a one-to-many (1—M) relationship if
for every row in the first table, there can be zero, one, or
many rows in the second table, but for every row in the
second table there is exactly one row in the first table.

Compiled By: Pankaj Kumar Bahety


Many-to-Many Relationships
Two tables are related in a many-to-many (M—M)
relationship when for every row in the first table, there can be
many rows in the second table, and for every row in the
second table, there can be many rows in the first table.
Many-to-many relationships can't be directly modeled in
relational database programs, including Microsoft Access.
These types of relationships must be broken into multiple
one-to-many relationships.

Compiled By: Pankaj Kumar Bahety


A Primary Key is one or more columns whose values
uniquely identify a row in a table.
A Candidate Key is one or more columns whose values
could be used to uniquely identify a row in a table. The
Primary Key is chosen among a table's Candidate Keys.

Compiled By: Pankaj Kumar Bahety

You might also like