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

DBMSBASICINTRDUCTION

dbms

Uploaded by

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

DBMSBASICINTRDUCTION

dbms

Uploaded by

suresh m
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 51

Database Management

Systems
Module-1:

INTRODUCTION TO DBMS
Syllabus

 Introduction and motivation, Data


independence, Three schema architecture,
Centralized and Client/Server architectures,
Database components, Database users, Entity
Types, Entity Sets, Attributes, Entity Type
(Strong and Weak), Relationship Types,
Relationship Sets, Roles, Structural Constraints,
ER diagram construction.
Basic Definitions
 Data:
Known facts that can be recorded and have an implicit meaning.
 Database:
 A collection of related data. It has the following implicit properties:
 A database represents some aspect of the real world, sometimes called the mini world.
 A database is a logically coherent collection of data with some inherent meaning.
 A database is designed, built, and populated with data for specific purpose.
 Examples: Airline reservation system, Students’ registration system
 Database Management System (DBMS):
A software package/ system to facilitate the creation and maintenance of a
computerized database.
 Database System:
The DBMS software together with the data itself. Sometimes, the applications are
also included.
Managing Data
 There are two approaches to manage data
 File-based approach: An approach that utilizes a
collection of application programs which performs
services to end-users (e.g. Reports). Each program
defines and manages its own data.
 Database approach: An approach that data is
collected and manipulated using specific software
called Database Management System, and many
programs share this data.
Disadvantages of File-Oriented Approach
 Data Redundancy and Inconsistency:
Multiple file formats, duplication of information
in different files

 Program or Data Dependency:


Programs are dependent on files and files are
dependent on data. Hence change in the physical
format of the file leads to the change in program also.

 Concurrent access by multiple users:


Concurrent access needed for performance
Uncontrolled concurrent accesses can lead to
inconsistencies E.g. two people reading a balance and
updating it at the same time
Disadvantages of File-Oriented Approach

 Difficulty in accessing Data:


Need to write a new program to carry out each new task
 Data Isolation:
multiple files and formats
 Data Integrity Issues:
Integrity constraints (e.g. account balance > 0) become part of program
code
Hard to add new constraints or change existing ones
 Data Atomicity Issues:
Failures may leave data in an inconsistent state with partial updates
carried out. E.g. transfer of funds from one account to another should either
complete or not happen at all
History and Motivation of a DataBase Systems

 The first general-purpose DBMS was designed


by Charles Bachman at General Electric in
the early 1960s and was called the Integrated
Data Store.

 In the late 1960s, IBM developed the


Information Management System (IMS) DBMS,
used even today in many major installations.

 IMS formed the basis for an alternative data


representation framework called the
hierarchical data model.
History and Motivation of a DataBase Systems

 In 1970, Edgar Codd, at IBM's San Jose Research


Laboratory, proposed a new data representation framework
called the relational data model.

 In the 1980s,The SQL(Structured Query Language) for


relational databases, developed as part of IBM's System R
project, is now the standard query language.

 SQL was standardized in the late 1980s, and the current


standard, SQL-92, was adopted by the American National
Standards Institute (ANSI) and International Standards
Organization (ISO).
Motivation / Advantages of DBMS

 Redundancy can be reduced

 Inconsistency can be avoided

 The data can be shared

 Standards can be enforced

 Security can be enforced

 Integrity can be maintained


Characteristics of database approach
1. Manages Information

A database manages all the information in their required fields (according to


column definition and ids).

2. Easy Operation Implementation

All the operations like insert, delete, update, search, etc. by SQL queries. It is a
flexible and easy way. For this user required information of column name and
appropriate value. Queries make it more powerful.

3. Multiple Views of Database

A view is a subset of the database or interface. It is defined according to user


requirements. Different users of the system may have different views of the same
system.

Every view contains only the data of interest to a user or a group of users.
Characteristics of database approach
4. Data for Specific Purpose

A database is designed for a specific purpose according to the group of user and application
interests.

For example, a database of the student management systems is designed to maintain the record of
students’ marks, fees, and attendance, etc. This data has the specific purpose of maintaining student
records.

For example, the library system has three types of users, 1. official administration of the college, 2.
librarian, and 3. students.

5. Represent Real World Applications

A database represents real-world applications. If any change in the real world then it is reflected in
the database. Example: - railway reservation system - Maintaining records of passengers, waiting list, train
arrival and departure time, certain day, etc. related to each train.

6. Logical Relationship Between Records and Data

A database maintains a logical relationship between records and data. So a user can access various
records according to various logical conditions by a single query from the database.
Characteristics of database approach
7. Insulation Between Program and Data

In the database approach, the data structure is stored in the system catalog, not in
the programs. If we want to change the structure of a file then no need to change the
program. This feature is called program-data independence.

It is not found in the file-based system.

8. Self-describing nature of a database system

A database system is referred to as self-describing by metadata. Metadata defines


and describes the data and relationships between tables in the database.

This information is used by the DBMS software or database users if needed. This type of
nature is not found in file-based systems.

9. Sharing of data and multiuser system

Current database systems can be accessed by multiple users at the same time. This feature is
called concurrency control strategies. These strategies ensure that the data accessed are
always correct and integrated.
Characteristics of database approach
10. Control of data redundancy

In the database approach, each data item is stored in only one place in the database. So single data
does not repeat more than one time. This feature improves system performance.

Redundancy is controlled by application programming and minimized when designing the database.

11. Enforcement of integrity constraints

Database approach provides the ability to define and enforce certain constraints to ensure that
users enter valid information and maintain data integrity.

A database constraint is a restriction or rule that dictates what can be entered or edited in a table
such as a postal code using a certain format or adding a valid city in the City field.

12. Restriction of unauthorized access

A database approach should provide security to create and control different types of user accounts
and restrict unauthorized access.

It provides privileges to access or use data from a database these are read-only access (i.e., the
ability to read a file but not make changes), and read and write privileges, (both read and modify a
file).
Characteristics of database approach
13. Transaction processing

A database approach supports a concurrency control subsystem that ensures that data
remains consistent and valid during transaction processing even if several users update the
same information.

14. Backup and recovery facilities

Backup and recovery are methods that are used to protect your data from loss. Backup
means storing database copy to another drive or place. If a hard drive fails or is not
accessible then it recovers the database from backup places.

If a computer system fails in a complex update process, the recovery method is accessed
and restored to its original state.
File System Vs Database System
 File system helps to store a collection of raw data files into the hard disk, where as
DBMS helps to easily store, retrieve and manipulate data in a database.

 In traditional file processing each user defines and implements the files needed
for a specific software application as part of programming the application. Where
as in DBMS data is not stored or created redundantly.

 Tasks such as storing, retrieving and searching are done manually in a file system
Therefore, it is difficult to manage data using a file system On the other hand,
operations such as updating, searching, selecting data is easier in DBMS because
it allows using SQL querying.

 File system has data inconsistency whereas DBMS provides higher data
consistency using normalization.
File System Vs Database System

 There is more redundant data in a file system whereas there is low data redundancy in a DBMS

 DBMS provides more security to the data than the file system

 Backup and recovery process is not efficient in file system because it is not possible to recover
the lost data On the contrary, a DBMS has a sophisticated backup and recovery

 File system is appropriate to handle data of a small scale organization or individual users On
the other hand, DBMS is suitable for medium to large organizations or multiple users.

 Handling the file system is simple but handling a DBMS is complex

 Examples:

 NTFS( Windows ) and Ext( Linux ) are some examples of file systems.

 MySQL, MSSQL, Oracle, and DB2 are some examples of DBMS.


Applications of DBMS

 Banking and financial services


 Culture and scientific information
 Transport
 Tourism
 Telemedicine
 Natural resource management
 Production engineering
 Computerized library system
 Automated teller machines
 Inventory and e-commerce
Components of database systems
Users

Software

Hardware
to store
data
Data

 User-defined Data:
It is the data for whose storage the database is created.
Example : Student data
Railway reservation data
 Meta-Data:
The database definition or descriptive information stored in the DBMS
catalog, which contains information such as the structure of each file, the
type and storage format of each data item, and various constraints on the
data.
Describes the primary structure of the database.
Software

 DBMS: – This is the software that helps the user to interact with the
database. It allows the users to insert, delete, update, or retrieve the
data. All these operations are handled by query languages like MySQL,
Oracle, etc.

 Database Application: – It is the application program which helps the


users to interact with the database by means of query languages. The
database application will not have any idea about the underlying DBMS.
Component
s of
Database
Manageme
nt System
Database Users
 Database Administrators:
 The DBA is responsible for authorizing access to the database, coordinating
and monitoring its use, and acquiring software and hardware resources as
needed.
 The DBA is accountable for problems such as security breaches and poor
system response time.
 In large organizations, the DBA is assisted by a staff that carries out these
functions.
 Database Designers:
 Responsible for identifying the data to be stored in the database and for
choosing appropriate structures to represent and store this data.
 These tasks are mostly undertaken before the database is actually
implemented and populated with data.
 It is the responsibility of database designers to communicate with all
prospective database users in order to understand their requirements and to
create a design that meets these requirements.
Database Users
End Users
 End users are the people whose jobs require access to the database for
querying, updating, and generating reports; the database primarily exists for
their use.
There are several categories of end users:
 Casual end users: occasionally access the database, but they may need
different information each time.
 Naive or parametric end users : Constantly query and update the database,
using standard types of queries and updates—called canned transactions.
Example: Reservation agents for airlines, hotels, and car rental companies
check availability for a given request and make reservations.
 Sophisticated end users: include engineers, scientists, business analysts, and
others who thoroughly familiarize themselves with the facilities of the DBMS in
order to implement their own applications to meet their complex requirements.
 Standalone users maintain personal databases by using ready-made program
packages that provide easy-to-use menu-based or graphics-based interfaces.
Example : user of a tax package that stores a variety of personal financial data
for tax purposes.
Database Users

 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.
Such analysts and programmers—commonly referred to as
software developers or software engineers—should be familiar with
the full range of capabilities provided by the DBMS to accomplish their
tasks
Storage Manager
 A storage manager is a program module that provides the interface
between the low-level data stored in the database and the application
programs and queries submitted to the system.
 The storage manager translates various DML statements into low-level
file system commands.
 Responsible for storing , retrieving and updating data in the database.
 Consists of:
 Authorization and Integrity Manager
 Transaction Manager
 File Manager
 Buffer Manager
Storage Manager
 Authorization and Integrity Manager: Checks for the satisfaction of
integrity constraints and authority of users to access data.
 Transaction Manager: Ensures that database remains in a correct
state despite of system failures and that concurrent transactions
execute without conflicting
 File Manager: Manages the allocation of space on disk storage and the
data structures used to represent information on the disk.
 Buffer Manager: Responsible for fetching data from the disk storage
into main memory.
Disk Storage

 Implements several data structures as part of physical system


implementation.
 Data files : Store the data base itself
 Data dictionary: Stores meta-data about the structure of database.
 Indices : Provides fast access to the data items
Query Processor

 DDL Interpreter: Interprets DDL statements and records the definitions


in the data dictionary.
 DML Compiler: Translates DML statements in a query language into an
evaluation plan consisting of low level instructions.
 Also performs query optimization
 Query Evaluation Engine: Executes low-level instructions generated
by the DML compiler.
Data models

 A data model is a collection of concepts that can be used to describe the


structure (data types, relationships, and constraints that apply to the
data) of a database.
 Most data models also include a set of basic operations for specifying
retrievals and updates on the database.
 Include concepts in the data model to specify the dynamic aspect or
behavior of a database application.
 This allows the database designer to specify a set of valid user-defined
operations that are allowed on the database objects
Categories of Data Models
 Low Level or physical Data models
 Representational or Implementation Data Models
 Relational Data Model
 Legacy Data Model
 Network Data Model
 Hierarchical Data model
 High- Level or Conceptual Data models
 Object oriented Data model
 ER-Model
Low Level or physical Data models

 Describe how the data is stored in a computer.


 Represents information such as
 Record Formats
 Record Orderings
 Access Paths
 Generally meant for Computer specialists but not for end users.
Representational or Implementational
Data Models
 Provide Concepts that may be understandable by end users but that are
not too far.
 Hide some details of data storage but can be implemented on a
computer system directly.
 Most Frequently Used in traditional and Commercial DBMS.
 Types: Relational and Legacy Data models.
Relational Data Model

 The relational model represents data and the relationships among data by a
collection of tables, which has a number of columns with unique names.
 Example of record based model
Legacy Data Model
 The term legacy database commonly refers to a database that has been in
use for many years and is therefore unsuitable for modern apps and
environments.
 Examples include databases based on flat files and those that reside on old
servers.
 But just because a database is legacy does not mean it is obsolete. There
are many applications that use it and need it to be operational.
 This is difficult to do for one or more of the following reasons:

 The data model is not properly documented with diagrams or data dictionaries.

 The database presents design and/or data quality problems.

 Any changes to its structure represent a great risk for the applications that use it.

 Two types : Network Data model and Hierarchical data model.


Network Data model
 The relationships among the data are many-to-many.
 One record is directly connected to others
 Structured in the format of a graph structure.
Hierarchical Data Model
 The relationships among data are in such a way that one data item is
present as subordinate of another one.
 Example: parent-child relationship
High level or Conceptual Data Models

 Provide concepts that are close to the way many users perceive data.
 They use concepts such as entities, attributes, relationships.
1. OBJECT-ORIENTED MODEL
 Each record is treated as an object
a. ER-Model:
 Based on perception of a real world that consists of a collection of basic
objects called entities and of relationships among these objects.
ER-Model
Levels of Data abstractions in DBMS
Physical level

 It is the lowest level of abstraction for DBMSs, defining how data is


stored, data structures for storing data, and database access
mechanisms.

 Developers or database application programmers decide how to store


data in the database.
 It is complex to understand.
Logical level

 The logical level is the next higher level or intermediate level.


 It explains what data is stored in the database and how those data are
related.
 It seeks to explain the complete or entire data by describing what tables
should be constructed and what the linkages between those tables
should be.
 It is less complex than the physical level.
View level

 This is the top level.


 There are various views at the view level, with each view defining only a
portion of the total data.
 It also facilitates user engagement by providing a variety of views or
numerous views of a single database.
 All users have access to the view level. This is the easiest and most
simple level.
Schema
 The description/design of Database is called the Database Schema.
 It represents the description of a database structure, data types, and the
constraints on the database.
 It is specified during the database design and is not expected to change
frequently.
 Schema Diagram: A displayed schema is known as schema diagram.
 A schema diagram only shows us the database design. It does not show
the actual data of the database.
 Schema can be a single table or it can have more than one table which
is related. The schema represents the relationship between these tables.
 Example:
Name Student_Num Class ID Branch
ber
Schema Diagram -
Database Architecture/
The Three Schema Architecture
 Separate the user applications from the physical database
Internal Level or Internal Schema

 Describes the physical storage structure of the database.


 The internal schema uses a physical data model and describes the
complete details of data storage and access paths for the database.
 In other words, it is the actual code that will be used to create the
structure of your database.
 In MySQL, you will use SQL to construct a database with tables.
Conceptual Level

 The conceptual level has a conceptual schema, which describes the


structure of the whole database for a community of users.
 The conceptual schema hides the details of physical storage structures
and concentrates on describing entities, data types, relationships, user
operations, and constraints.
 Usually, a representational data model is used to describe the
conceptual schema when a database system is implemented.
 Database administrators must decide what information to keep in the
database
 Uses logical level of abstraction
 Example: ER-Diagram
External level or view level

 The highest level of abstraction.


 Describes only the part of the entire database.
 The view level of abstraction exists to simplify the interaction with the
system.
 The system may provide many views for the same database.

The three-schema architecture is a convenient tool with which the user can
visualize the schema levels in the database system
Data Independence

 The capacity to change the schema at one level of database without


having to change the schema at next higher level of the database.

 Two types of Data Independence:

 Logical Data Independence

 Physical Data Independence


Logical data Independence

 It is the capacity to change the conceptual schema without having to


change external schemas or application programs.
 We may change conceptual Schema to:
 Expand database
 To change constraints
 Reduce the database
 Only the view definition and mappings need to be changed in a DBMS
that supports logical data independence.
Physical Data Independence
 Capacity to change the internal schema without having to change the
conceptual schema. Hence, the external schemas need not be changed as
well.
 We may change physical Schema to:
 Re-organize some physical files to improve the performance of retrieval or
update.
 Generally, Physical data independence exists in most databases and file
systems in which exact data on the disk , hardware details of
storage ,placement compression etc are hidden from the user.

 For more info:


 https://afteracademy.com/blog/what-is-a-schema/

You might also like