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

DBMS

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)
10 views

DBMS

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/ 68

Database

Technologies
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.
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.
Definition: A database is a collection of information organized
into interrelated tables of data and specifications of data objects.
Description.

.
Database
Management
System
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.
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.
What was the need of Database Management System ?
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 most of the time
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.
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
What are the advantages of DBMS ?
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
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
Advantages of DBMS

 Conflict Resolutions

 Data Independence
DBMS
Architecture
Naive Application Sophisticated Database Users
Users Programmers Users Administrator

Application Application Query Database


Interface Program Schema

Embedded DDL
DML
DML Interpreter
Application Compiler Query
Complier Query
Program Processor
Object Code Evaluation
Engine

DBMS
Buffer
Manager Storage
Transaction
Manager Manager
File
Manager

Data
Data Files Indices Statistical Data Dictionary
DML compiler

Which translate DML statements in a query


language into low level instructions that the
query evaluation engine understand.

Home
Embedded DML precompiler

Which converts DML statements embedded in a application program


to normal procedure calls in the host language.

The precompiler must interact with the DML complier to generate


the appropriate code

Home
DDL Interpreter
Which interprets DDL statements and
records them in a set of tables containing
metadata.

Home
Query Evaluation Engine

Which executes low-level instructions


generated by the DML compiler

Home
Transaction Manager
Which ensure that the database remains in a
consistent state despite system failure, and that
concurrent transaction execution proceed without
conflicting.

Home
File Manager
Which manages the allocation of space on
disk storage and the data structures used
to represent information stored on disk.

Home
Buffer Manager
Which is responsible for fetching data
from disk storage into main memory,
and deciding what data to cache in
memory.

Home
Data Files
Which stores the database itself.

Home
Data Dictionary

Which stores metadata about the structure of


the database

Home
Indices
Which provides fast access to data items that hold
particular value

Home
Statistical data
Which stores the statistical information about
the data in the database. This information is
used by the query processor to select
efficient way to execute a query.

Home
Naive users

Unsophisticated users who interact with the


system by invoking one of the permanent
application program that have been written
previously.

Home
Application Programmer

Computer professionals who interact with the


system through DML calls, which are embedded in
a program written in a host language.

Home
Sophisticated User
Interact with the system without writing
programs. Instead they form their request in
a database query language.

Home
Data Abstraction

Hide certain details of how the data are stored and maintained from
the user
Physical Level

Logical Level

View Level
Data Abstraction

Physical Level

The lowest level of abstraction

Complex low level described in detail

Logical Level

The next higher level of abstraction describes what data are stored.
What relationship exist among the data.
The entire DB is described in terms of a small number of relatively
simple structures.
This may involve complex physical level structures.
Data Abstraction
View Level

The highest level of abstraction


Describes only a part of the entire DB
Entire interaction with the system simplified
 Users access a part of the DB
The system may provides many views of the same DB
View 1 View 2 View 3

Logical Level

Physical Level
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.
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
DDL

Data Definition Language


Used to define the schema of the DB
This schema definition include all the entity sets associated
attribute as well as the relationship among the entity set.
Includes any constraints that have to be maintained.
These definitions which can be described as metadata about data in
the database
These details are maintained in a set of tables called data
dictionary, data directory or system catalog.
DML

Data Manipulation Language


Involves retrieval of data from the database, insertion of new data,
deletion and modification of existing data
DML provides various commands
This can be used as an interactive mode or embedded in
conventional programming language.

DML can be procedural, specify not only what to retrieve but to


specify how to retrieve.

Non-Procedural specify only what to retrieve


Database Schema

Database schema is the logical design of the database

Database Instance

A snapshot of the data base at a given time

Conclusion

DDL is related to Database schema

DML Database Instance


Data Dictionary

Information pertaining to the structure and usage of data, metadata


Data dictionary is a database itself.
Each database user can consult with the data dictionary to learn
what each piece of data mean
The data dictionary may contain the source of each data field value,
the frequency of its use, the audit trial concerning updates.
Further more, Names of the relation, Names of the attributes of
each relation, integrity constraints etc
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.
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.
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.
Types Of Traditional Data
Models :
1.Hierarchal
2.Network
3.Relational
Data Models

Hierarchiel Data Model :

The Hierarchiel model relates entities by parent / child or superior / subordinate relationship . e.g
.An organization chart . Graphically the hierarchiel model is shown as an Inverted tree , with the
highest level of the tree known as the root . The nodes of the tree represents entities .

Hierarchiel Model permits two types of relationships .


One to One
One to Many
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.
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
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.
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.
Network Data Model

The network data model is similar to the herarchiel model , except that an
entity can have more than one parent .

Graphically it is represented as an arbitrary graph . It permits all types of


relationships.
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.
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.
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.
Relational Data Model :

The Relational data model is currently the most popular in DBMS , because
it is conceptually simple and understandable by information systems
professionals . It uses data values to imply relationships. A relational data
model is based on a relation , a two dimensional table . Rows representing
records and columns show the attributes of the entity.

Empno Name Address Department Basic


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 .
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.

You might also like