Post on 10-Apr-2018
Prepared By Meri Dedania (AITS)
Database Management System
byMeri DedaniaAssistant Professor
MCA department
Atmiya Institute of Technology & Science
Yogidham Gurukul
Rajkot
Prepared By Meri Dedania (AITS)
Chapter -1
Introduction
Prepared By Meri Dedania (AITS)
Database
File System
Prepared By Meri Dedania (AITS)
Disadvantages of File System
Data Redundancy and Inconsistency
Difficulty in accessing data
Data isolation
Integrity Problems
Atomicity Problems
Concurrent-access anomalies
Security Problems
Prepared By Meri Dedania (AITS)
Name Address
ABC Bhiwani
DEF Delhi
AccNo Name Address
1002 ABC Bhiwani1005 DEF Jaipur
Data Redundancy and Inconsistency
Customer Information Saving Account
Prepared By Meri Dedania (AITS)
Data Redundancy and Inconsistency
Name Address
DEF Delhi
ABC Bhiwani
AccNo Name Address
1005 DEF Jaipur
1002 ABC Bhiwani
Customer InformationSaving Information
Manager
Requirement
ApplicationPrograms
File System
(ProgramsWritten in CPascal etc.)
(Data Structure
File Handling)
Database(Information Storage
in Files Format)
Difficulty in accessing data
Prepared By Meri Dedania (AITS)
Program in CProgram in C Program in COBOL
#include <stdio.h>Main()
{
-----}
New Document
01 Reserve-rec.03 saving
05 accno PIC A(2)
--------
Data Isolation
Prepared By Meri Dedania (AITS)
Atomicity Problems
Bank Data Transaction
User A User B
Prepared By Meri Dedania (AITS)
Concurrent-access anomalies
Prepared By Meri Dedania (AITS)
Employee
Information
Security Problem
Prepared By Meri Dedania (AITS)
Data Model
Data Models are internal Structure of Database.
It is collection of conceptual tools for describing data , data
relationships , data semantics , and consistency constraints.
A data model provides a way to describe the design of a
database at the physical , logical and view level.
The data models can be classified in four categories.
Hierarchical database model :
This is a data model in which the data is
organized into a tree structure.
The structure allows representing
information using parent/child relationships.
each parent can have many children, but
each child has only one parent (also known
as a 1-to-many relationship).
All attributes of a specific record are listed
under an entity type.
Network Data Model
The network model organizes data using
two fundamental concepts, called records
and sets.
Records contain fields.
Sets define one-to-many relationships
between records: one owner, many
members.
A record may be an owner in any number
of sets, and a member in any number of
sets.
Prepared By Meri Dedania (AITS)
1. Relational Data Model : Using Collection of tables to represent both data and data
relationship among those data.
Each table has multiple column and each column has unique name.
Each table contains records of a particular type.
The Relational Data model is simplified the user’s view of the database.
Tables are related with each other by sharing common entity characteristics
Suppose two tables are CUSTOMER and AGENT.
CUSTOMER table contains fields are CUST_ID , CUST_NAME , CUST_PHONE , AGENT_ID.
AGENT table contains field are AGENT_ID , AGENT_NAME , AGENT_PHONE , AGENT_SAL.
Even data are stored into different table , the common link b/w the CUSTOMER and AGENT table is AGENT_ID.
Although both table are completely independent of one another , data b/w the table can be easily connect using common links.
Prepared By Meri Dedania (AITS)
CUSTOMER
CUST_ID
CUST_NAME
CUST_PHONE
AGENT_ID
AGENT
AGENT_ID
AGENT_NAME
AGENT_PHONE
AGENT_SAL
Advantages of Relational Data Model
1. Simplicity :
Simplicity in Designing.
2. Structural Independence :
Changes in the database structure do not affect the data access.
3. Ease of design , implementation , maintenance and uses :
Relational Data model provides structural and data independence both..
4. Flexible and powerful query capability : SQL
Disadvantages of Relational Model
Hardware Overhead :
It need more powerful computing
hardware and data storage device to
perform RDMS assign tasks.
There fore they tend to be slower than
other database systems.
Meri Dedania
Object Oriented Data ModelsRelational DB is widely successful in variety of
application areas.
However it does not support the distribution of database across the number of servers.
Due to these reasons , ODBMS is developed.
ODBMS is among the most recent approaches to the DBMS.
They started in the engineering and domain application.
And became the favored system for financial , telecommunication , and WWW application and multi media application.
It has capacity of storing different types of
data for example , pictures ,voice , video ,
including text , numbers and so on.
It is capable to combine object oriented
programming with database technology and
thus providing an integrated application
development system.
It provides powerful features like
inheritance , polymorphism.
Prepared By Meri Dedania (AITS)
E-R Data ModelThe E-R model is a high-level data model.
It is based on a perception of a real world that consists of a collection of basic objects.
That object is called entity.
E-R model based on relationship among these objects.
E-R model is widely used in database design.
Some specific Symbols or Blocks are used to represent E-R diagram
Like Rectangular Boxes represent entity.
Oval boxes represent Attributes
Diamond boxes represents relationship.
There is no industry standard notation for Developing E-R Diagram
It Is widely used for designing of relational databases.
Prepared By Meri Dedania (AITS)
Advantages of E-R Model Straight forward relational representation :
Easy Conversion from E-R to other data models
Graphically representation for better understanding.
Disadvantages of E-R model
No industry standard for notation:
Popular for high level design
Prepared By Meri Dedania (AITS)
Semi structured Data Model
The semistructured data model is permits the
specification of data where individual data of same type
may have different set of attributes.
The XML is widely used to represent semistructured
data.
Prepared By Meri Dedania (AITS)
Database Language
A database system provides a database definition
language and database manipulation language to specify
database schema and to express database queries and
update respectively.
These two are not different languages , they are
simply form parts of a single database language , such as
SQL
Prepared By Meri Dedania (AITS)
Data Manipulation Language
A data manipulation language is a language that
enables users to access or manipulate data as organized
by the appropriate data model.
The types of access are :
1) Retrieval of information stored in the database.
2) Insertion of new information into the database
3) Deletion of information from the database
4) Modification of information stored in the database
Prepared By Meri Dedania (AITS)
These are basically two types :
1. Procedure DMLs : require a user to specify whatdata are needed and how to get those data.
2. Non Procedure DMLs : It is called Declarative DMLs also. Require a user to specify what data are needed without specifying how to get those data.
Declarative DMLs are usually easier to learn and use than are procedural DMLs.
However , since a user does not have to specify how to get the data , the database systems has to figure out an efficient means of accessing data.
A query is a statement requesting the retrieval of information.
The portion of a DML that involves information retrieval is called a query language.
Prepared By Meri Dedania (AITS)
Although technically incorrect , it is common practice
to use the terms query language and data manipulation
language synonymously.
There are a number of database query language is use
, either commercially or experimentally.
insert , delete , update
Prepared By Meri Dedania (AITS)
A language by which we can specify database schema
by a set of definitions that is called data definition
languages.
The DDL is also used to specify additional properties
of the data.
We can specify storage structure and access methods
used by the database system by a set of statement in a
special type of DDL called data storage and
definition language.
This statement define the implementation details of
the database schemas, which are usually hidden form
the users.
Data-Definition Language
Prepared By Meri Dedania (AITS)
The data value stored in the database must satisfy
certain consistency constraints.
i.e the balance on an account should not fall below
$100.
The DDL provides facilities to specify such
constraints.
The database system check this constraints every time
and database is update.
Create , alter , drop , truncate, rename
Prepared By Meri Dedania (AITS)
Domain Constraint :
Every attributes has domain with possible values.
Declaring an attribute to be of a particular domain
acts as a constraint on the values that it can take.
Domain constraints are the most elementary form of
integrity constraint.
They are tested easily by the system whenever a new data
item is entered into the database.
Prepared By Meri Dedania (AITS)
Referential IntegrityThese are cases where we wish to ensure that a value
that appears in one relation for a given set of attribute
also appears for a certain set of attributes in another
relation.
Database modification can cause violations of
referential integrity.
When a referential integrity constraints is violated ,
the normal procedure is to reject the action that
caused the violation.
Assertions
An assertion is any condition that the
database must always satisfy.
Domain constraints and referential integrity
constraints are special forms of assertions.
However , there are many constraints that
we cannot express by using only these
forms.
For example , “Every loan has at least one
customer who maintains an account with a
minimum balance of $1000.00” must be
expressed as an assertion.
When an assertion is created , the system
tests it for validity.
If the assertion is valid , then any future
modification to the database is allowed
only if it does not cause that assertion to
be violated.
Authorization We may want to differentiate among the users as
far as the types of access they are permitted on various data values in the database.
These differentiations are expressed in terms of authorization , the most common being ;
read authorization , which allows reading ,but not modification of data.
insert authorization , which allows insertion of new data , but not modification of existing data.
Update authorization , which allows modification but not deletion of data.
Delete authorization , which allows deletion of data.
We may assign the user all , none or a combination of these types of authorization.
The DDL , just like any other programming language , gets an input some instruction and generate some output.
The output of the DDL is the placed in the data dictionary , which contains meta data , that about data about data.
The Data dictionary is considered to be a special types of table , which can only be accessed and updated by database system itself.
The database system consultants the data dictionary before reading or modifying actual data
DCL (Data Control Language)
GRANT - gives user's access privileges to database
REVOKE - withdraw access privileges given with the GRANT command
TCL (transaction control language)
Commit : save work done
Rollback : restore database to original since the last COMMIT
DQL (Data Query Language)
select
Meri Dedania