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

DBMS Unit 1 Notes

dbms

Uploaded by

nareshjha9876
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

DBMS Unit 1 Notes

dbms

Uploaded by

nareshjha9876
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Introduction to Databases

BCA 501

Faculty:
Mr. Munish Sharma

1
Objectives

• At the end of this lecture, student will be able to


– explain the concept of database with an example
– explain the characteristics of DBMS
– identify database users
Topics

• Basic Definitions
• Typical DBMS Functionality
• Example of a Database (UNIVERSITY)
• Main Characteristics of the Database Approach
• Database Users
• Advantages of Using the Database Approach
• When Not to Use Databases
• Recent database applications
Introduction
• Data can be stored in normal text or binary files
• As data grows, and applications need to manipulate data in complex ways, this
simplistic approach of storing data may not be sufficient

• One of the best alternatives to files is to store data in databases

• Databases allow us to manipulate and store data in an organized way, and hence
transform data into meaningful information
• In today’s world, a database is an integral part of any application
What is a Database?

Definition of a database in Wikipedia, the free online encyclopedia, is as follows

“A database is a collection of records stored in a computer in a systematic way, so that


a computer program can consult it to answer questions. The items retrieved in
answer to queries become information that can be used to make decisions.”
Database
• Database can be of any size and complexity
– The list of names and addresses in an address book may consist of only a few hundred
records, each with a simple structure
– The computerized catalog of a large library may contain half a million entries organized
under different categories
– The database to monitor tax forms filed by citizens in a country
– An example of a large commercial database is Amazon.com

• A database may be generated and maintained manually or it may be computerized


– A library card catalog is a database that may be created and maintained manually
– A computerized database may be created and maintained either by a group of
application programs written specifically for that task or by a database management
system
Some Database Applications
• Banking: For customer information, accounts, loans, and banking transactions
• Airlines: for reservations, schedules information
• Universities: For student information, course registrations, and grades
• Sales: for customers, products, and purchases
• Human resources: employee records, salaries, tax deductions
Some Database Applications contd.

8
Basic Definitions
• Data
– Facts that can be recorded and that have implicit meaning

• Database
– Collection of related data

• Database management system


– A collection of programs that enables users to create and maintain a database

• Database system
– Database and DBMS software together
Typical DBMS Functionality
• DBMS is a general-purpose software system that facilitates the processes of
defining, constructing, manipulating, and sharing databases among various users
and applications

• Defining a database - specifying the data types, structures, and constraints of the data to be
stored in the database
• Constructing the database - process of storing the data on some storage medium that is
controlled by the DBMS
• Manipulating a database - functions such as querying the database to retrieve specific data,
updating the database to reflect changes, and generating reports from the data
• Sharing a database - allows multiple users and programs to access the database simultaneously
Simplified Database System Environment
Example of a Database
• Mini-world for the example
– UNIVERSITY database for maintaining information concerning students, courses, and
grades in a university environment

• Some mini-world entities


– STUDENTs - stores data on each student
– COURSEs - stores data on each course
– SECTIONs (of COURSEs) -stores data on each section of a course
– GRADE_REPORT -stores the grades that students receive in the various sections they have
completed
– PREREQUISITE - stores the prerequisites of each course
Example of a Database contd.
Characteristics of the Database Approach
• The main characteristics of the database approach versus the file-processing
approach
– Self-describing nature of a database system
– Insulation between programs and data, and data abstraction
– Support of multiple views of the data
– Sharing of data and multiuser transaction processing
Database Users
1. Actors on the scene
– people whose jobs involve the day-to-day use of a large database

2. Workers behind the scene


– who work to maintain the database system environment but who are not actively
interested in the database contents as part of their daily job
Actors on the Scene
1. Database Administrator (DBA)
– chief administrator to oversee and manage the resources
– responsible for authorizing access to the database, coordinating and monitoring its use, and
acquiring software and hardware resources as needed

2. Database Designers
– responsible for identifying the data to be stored in the database and for choosing appropriate
structures to represent and store this data
– mostly undertaken before the database is actually implemented and populated with data
– must communicate with the end-users and understand their needs
– the final database design must be capable of supporting the requirements of all user groups
Actors on the Scene contd.
3. End users
– people whose jobs require access to the database for querying, updating, and generating reports;
the database primarily exists for their use
– categories of end users
 Casual end users
 Naive or parametric end users
 Sophisticated end users
 Standalone users

4. System Analysts and Application Programmers (Software Engineers)


– System analysts - determine the requirements of end users, especially naive and parametric end
users, and develop specifications for standard canned transactions that meet these requirements
– Application programmers - implement these specifications as programs; then they test, debug,
document, and maintain these canned transactions
Workers Behind the Scene
• Associated with the design, development, and operation of the DBMS software and
system environment
1. DBMS system designers and implementers
– design and implement the DBMS modules and interfaces as a software package
2. Tool developers
– design and implement tools—the software packages that facilitate database modeling and
design, database system design, and improved performance
– tools are optional packages that are often purchased separately
– they include packages for database design, performance monitoring, natural language or
graphical interfaces, prototyping, simulation, and test data generation
3. Operators and maintenance personnel (system administration personnel)
– responsible for the actual running and maintenance of the hardware and software environment
for the database system
Advantages of Using the DBMS Approach
• Controlling Redundancy
– Duplication of effort
– Wastage of storage space
– Inconsistency
• Restricting Unauthorized Access
• Providing Persistent Storage for Program Objects
• Providing Storage Structures and Search Techniques for Efficient Query Processing
• Providing Backup and Recovery
• Providing Multiple User Interfaces
• Representing Complex Relationships among Data
• Enforcing Integrity Constraints
When not to use a DBMS
• The overhead costs of using a DBMS are due to
– High initial investment in hardware, software, and training
– The generality that a DBMS provides for defining and processing data
– Overhead for providing security, concurrency control, recovery, and integrity functions

• It may be more desirable to use regular files under the following circumstances
– Simple, well-defined database applications that are not expected to change at all
– Stringent, real-time requirements for some application programs that may not be met because of
DBMS overhead
– No multiple-user access to data
Recent Database Applications
• Scientific applications that store large amounts of data resulting from scientific
experiments in areas such as
– high-energy physics
– mapping of the human genome
– discovery of protein structures

• Storage and retrieval of images, including


– scanned news or personal photographs
– satellite photographic images
– images from medical procedures such as x-rays and MRIs

• Storage and retrieval of videos, such as


– movies, and video clips from news or personal digital cameras
Recent Database Applications contd.
• Data mining applications that
– analyze large amounts of data searching for the occurrences of specific patterns or
relationships
– identify unusual patterns in areas such as credit card usage

• Spatial applications that store spatial locations of data, such as


– weather information
– maps used in geographical information systems
– in automobile navigational systems

• Time series applications that store information such as


– economic data at regular points in time, such as daily sales and monthly gross national
product figures
FILE ORIENTED APPROACH:

The earliest business computer systems were used to process business records and
produce information. They were generally faster and more accurate than equivalent
manual systems. These systems stored groups of records in separate files, and so they
were called file processing systems.
– File system is a collection of data. Any management with the file system, user has
to write the procedures
– File system gives the details of the data representation and Storage of data.
– In File system storing and retrieving of data cannot be done efficiently.
– Concurrent access to the data in the file system has many problems like a
Reading the file while other deleting some information, updating some
information

23
– File system doesn’t provide crash recovery mechanism.
Eg. While we are entering some data into the file if System crashes then content of the
file is lost.

– Protecting a file under file system is very difficult.

The typical file-oriented system is supported by a conventional operating system.


Permanent records are stored in various files and a number of different application
programs are written to extract records from and add records to the appropriate files.

24
DISADVANTAGES OF FILE-ORIENTED SYSTEM:
The following are the disadvantages of File-Oriented System:
Data Redundancy and Inconsistency:
Since files and application programs are created by different programmers over a long
period of time, the files are likely to be having different formats and the programs may
be written in several programming languages. Moreover, the same piece of information
may be duplicated in several places. This redundancy leads to higher storage and
access cost. In addition, it may lead to data inconsistency.
Difficulty in Accessing Data:
The conventional file processing environments do not allow needed data to be
retrieved in a convenient and efficient manner. Better data retrieval system must be
developed for general use.

25
Data Isolation:
Since data is scattered in various files, and files may be in different formats, it is
difficult to write new application programs to retrieve the appropriate data.

Concurrent Access Anomalies:


In order to improve the overall performance of the system and obtain a faster response
time, many systems allow multiple users to update the data simultaneously. In such an
environment, interaction of concurrent updates may result in inconsistent data.

Security Problems:
Not every user of the database system should be able to access all the data. For
example, in banking system, payroll personnel need only that part of the database that
has information about various bank employees. They do not need access to
information about customer accounts. It is difficult to enforce such security constraints.

26
Integrity Problems:The data values stored in the database must satisfy certain types of
consistency constraints. For example, the balance of a bank account may never fall
below a prescribed amount. These constraints are enforced in the system by adding
appropriate code in the various application programs. When new constraints are
added, it is difficult to change the programs to enforce them. The problem is
compounded when constraints involve several data items for different files.

Atomicity Problem:
A computer system like any other mechanical or electrical device is subject to failure. In
many applications, it is crucial to ensure that once a failure has occurred and has been
detected, the data are restored to the consistent state existed prior to the failure

27
The Evolution of Database systems:

The Evolution of Database systems are as follows:

1. File Management System


2. Hierarchical database System
3. Network Database System
4. Relational Database System

28
DBMS Database Models

29
File Management System:
The file management system also called as FMS in short is one in which all data is stored on a
single large file. The main disadvantage in this system is searching a record or data takes a long
time. This lead to the introduction of the concept, of indexing in this system. Then also the FMS
system had lot of drawbacks to name a few like updating or modifications to the data cannot
be handled easily, sorting the records took long time and so on. All these drawbacks led to the
introduction of the Hierarchical Database System.
Hierarchical Database System:
The previous system FMS drawback of accessing records and sorting records which took a long
time was removed in this by the introduction of parent-child relationship between records in
database. The origin of the data is called the root from which several branches have data at
different levels and the last level is called the leaf. The main drawback in this was if there is any
modification or addition made to the structure then the whole structure needed alteration
which made the task a tedious one. In order to avoid this next system took its origin which is
called as the Network Database System.

30
31
Network Database System:

In this the main concept of many-many relationships got introduced. But this also
followed the same technology of pointers to define relationships with a difference in
this made in the introduction if grouping of data items as sets.

32
Relational Database System:
In order to overcome all the drawbacks of the previous systems, the Relational
Database System got introduced in which data get organized as tables and each record
forms a row with many fields or attributes in it. Relationships between tables are also
formed in this system.

33
Data Independence in DBMS: Physical & Logical
with Examples
What is Data Independence of DBMS?
• Data Independence is defined as a property of DBMS that helps you to change the
Database schema at one level of a database system without requiring to change the
schema at the next higher level. Data independence helps you to keep data
separated from all programs that make use of it.

• You can use this stored data for computing and presentation. In many systems, data
independence is an essential function for components of the system.

34
Types of Data Independence
In DBMS there are two types of data independence
Physical data independence
Logical data independence.
Levels of Database
Before we learn Data Independence, a refresher on Database Levels is
important. The database has 3 levels as shown in the diagram below
Physical/Internal
Conceptual
External

35
Levels of DBMS Architecture Diagram

36
Consider an Example of a University Database. At the different levels this is how the
implementation will look like:

Type of Schema Implementation

External Schema View 1: Course info(cid:int,cname:string)


View 2: studeninfo(id:int. name:string)

Conceptual Shema Students(id: int, name: string, login: string, age: integer)
Courses(id: int, cname.string, credits:integer)
Enrolled(id: int, grade:string)

Physical Schema  Relations stored as unordered files.

 Index on the first column of Students.

37
• Physical Data Independence
• Physical data independence helps you to separate conceptual levels from the
internal/physical levels. It allows you to provide a logical description of the database
without the need to specify physical structures. Compared to Logical Independence,
it is easy to achieve physical data independence.
• With Physical independence, you can easily change the physical storage structures
or devices with an effect on the conceptual schema. Any change done would be
absorbed by the mapping between the conceptual and internal levels. Physical data
independence is achieved by the presence of the internal level of the database and
then the transformation from the conceptual level of the database to the internal
level.

38
• Examples of changes under Physical Data Independence
• Due to Physical independence, any of the below change will not affect the
conceptual layer.
• Using a new storage device like Hard Drive or Magnetic Tapes
• Modifying the file organization technique in the Database
• Switching to different data structures.
• Changing the access method.
• Modifying indexes.
• Changes to compression techniques or hashing algorithms.
• Change of Location of Database from say C drive to D Drive

39
Logical Data Independence
• Logical Data Independence is the ability to change the conceptual scheme without
changing
• External views
• External API or programs
• Any change made will be absorbed by the mapping between external and
conceptual levels.
• When compared to Physical Data independence, it is challenging to achieve logical
data independence.

40
Examples of changes under Logical Data Independence
• Due to Logical independence, any of the below change will not affect the external
layer.
• Add/Modify/Delete a new attribute, entity or relationship is possible without a
rewrite of existing application programs
• Merging two records into one
• Breaking an existing record into two or more records

41
Difference between Physical an Logical Data Independence
Logica Data Independence Physical Data Independence

Logical Data Independence is mainly concerned with the structure or changing Mainly concerned with the storage of the data.
the data definition.

It is difficult as the retrieving of data is mainly dependent on the logical It is easy to retrieve.
structure of data.

Compared to Logic Physical independence it is difficult to achieve logical data Compared to Logical Independence it is easy to achieve physical data
independence. independence.

You need to make changes in the Application program if new fields are added A change in the physical level usually does not need change at the Application
or deleted from the database. program level.

Modification at the logical levels is significant whenever the logical structures Modifications made at the internal levels may or may not be needed to improve
of the database are changed. the performance of the structure.

Concerned with conceptual schema Concerned with internal schema

Example: Add/Modify/Delete a new attribute Example: change in compression techniques, hashing algorithms, storage
devices, etc
42
Importance of Data Independence

• Helps you to improve the quality of the data


• Database system maintenance becomes affordable
• Enforcement of standards and improvement in database security
• You don't need to alter data structure in application programs
• Permit developers to focus on the general structure of the Database rather than
worrying about the internal implementation
• It allows you to improve state which is undamaged or undivided
• Database incongruity is vastly reduced.
• Easily make modifications in the physical level is needed to improve the
performance of the system.

43
DBMS Architecture

• What is Database Architecture?


• DBMS architecture helps in design, development, implementation, and maintenance
of a database. A database stores critical information for a business. Selecting the
correct Database Architecture helps in quick and secure access to this data.

44
1 tier Architecture

1-tier Architecture Diagram


• The simplest of Database Architecture are 1 tier where the Client, Server, and
Database all reside on the same machine. Anytime you install a DB in your system
and access it to practise SQL queries it is 1 tier architecture. But such architecture is
rarely used in production.

45
2-tier Architecture
• A two-tier architecture is a database architecture where
• Presentation layer runs on a client (PC, Mobile, Tablet, etc)
• Data is stored on a Server.
• An application interface which is called ODBC (Open Database Connectivity) an API
which allows the client-side program to call the DBMS. Today most of the DBMS
offers ODBC drivers for their DBMS. 2 tier architecture provides added security to
the DBMS as it is not exposed to the end user directly.
• Example of Two-tier Architecture is a Contact Management System created using
MS- Access.

46
In the above 2-teir architecture we can see that one server is connected with clients 1, 2m and 3. This
architecture provides Direct and faster communication.

47
3-tier Architecture

• 3-tier schema is an extension of the 2-tier architecture. 3-tier architecture has


following layers
• Presentation layer (your PC, Tablet, Mobile, etc.)
• Application layer (server)
• Database Server

48
This DBMS architecture contains an Application layer 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
Three tier architecture is the most popular DBMS architecture.
The goal of Three-teir architecture is:
To separate the user applications and physical database
Proposed to support DBMS characteristics
Program-data independence
Support of multiple views of the data
Example of Three-teir Architecture
Any large website on the internet.
49
Summary
• Database is a collection of related data, where data means recorded facts
• A typical database represents some aspect of the real world and is used for specific
purposes by one or more groups of users
• A DBMS is a generalized software package for implementing and maintaining a
computerized database
• The database and software together form a database system
• Main categories of database users are actors on the scene and behind the scene
• Traditional database applications were based on the text or numeric data

You might also like