Chapter_2_Database_System_Concepts_and_Architecture_final_for_students
Chapter_2_Database_System_Concepts_and_Architecture_final_for_students
1
Chapter 2 Topics
2
Data Models
3
Data Models..
• Data Model: a set of concepts to describe the structure of a
database, and certain constraints that the database should obey.
• A data model is a description of the way that data is stored in a
database.
• Data model helps to understand the relationship between entities
and to create the most effective structure to hold data.
• A set of primitives for defining the structure of a database.
• A set of operations for specifying retrieval and updates on a database
• Data Model is a collection of tools or concepts for describing
– Data
– Data relationships
– Data semantics
– Data constraints
• The main purpose of Data Model is to represent the data in an
understandable way.
Categories of database models include:
– Object-based
– Record-based
– Physical
Record-based Data Models
• Consist of a number of fixed format records. Each record type
defines a fixed number of fields, Each field is typically of a fixed
length. The following are examples of this database
model category.
many children.
• The main drawback of this model is that, it can have only one
arbitrary depth
• Each record contain multiple fields, where each field may contain
and one-to-one
to other records)
Advantages
linked records.
• Owner
• Member
52
Advantages
• Conceptual simplicity
• Data independence
Extensibility
Disadvantages
• The object relational data model can get quite complicated and difficult
model and Relational data model and utilizes the functionalities of both
of them.
Schemas versus Instances
40
Instance
41
Architecture of DBMS
• The Database Management System (DBMS) architecture
shows how data in the database is viewed by the users.
It is not concerned about how the data are handled and
processed by the DBMS.
42
The Three-Level ANSI-SPARC Architecture
43
• The three-schema architecture divides the database into three-
level used to create a separation between the physical database
and the user application.
• In simple terms, this architecture hides the details of physical
storage from the user.
• External level
• Conceptual level
• Internal level
45
ANSI-SPARC Three-Level Architecture
How the
user is
viewing the
data
What data is stored
46
Objectives of Three-Level Architecture
• All users should be able to access same data.
• A user’s view is immune to changes made in other views.
• Users should not need to know physical database storage
details.
• DBA should be able to change database storage structures
without affecting the users’ views.
50
Internal or Physical level
data is stored in the database and provides the methods to access data
• The internal schema not only defines different stored record types, but
also specifies what indices exist, how stored fields are represented.
52
Schemas, Mappings, and Instances
54
Data Independence
55
Data Independence
schemas.
56
Data Independence and the ANSI-SPARC Three-Level
Architecture
57
Database Languages and Interfaces
• Data Definition Language (DDL)
– Allows the DBA or user to describe and name entities, attributes, and
relationships required for the application together with any associated
integrity and security constraints.
– DDL is a descriptive language for defining and constructing the
database.
– Allows users to specify the data types and structures and the
constraints on the data to be stored in the DB.
– DDL compiler generates the meta-data (describes objects in database
and make it easier for manipulation) that is stored in the data
dictionary. 58
• The DDL used to define and change the conceptual schema of the
database
59
Database Languages
• Data Manipulation Language (DML)
• Provides basic data manipulation operations on data held in the database.
• DML is a language for retrieving and updating (insert, delete, & modify) the data in
the DB. It is called Query language.
• Types of DML:
• Low level or Procedural Language: user specifies what data is required and how to
get those data(allows user to tell system exactly how to manipulate data.) It is
embedded in a high-level languages.
• High level or Nonprocedural Language: user specifies what data is required without
specifying how to get those data(allows user to state what data is needed rather than
how it is to be retrieved.). It is called declarative languages, such as SQL.
60
• The DML is used at the conceptual and view levels to retrieve, insert ,
delete , modify information stored in database
– SELECT
– INSERT
– UPDATE
– DELETE
– MERGE
CALL
EXPLAIN PLAN
– LOCK TABLE
61
Database Languages
62
DCL-Data Control Language
63
TCL – Transaction control Language
• Used to run the changes made by the DML statement.
• TCL Commands:
• Commit;-used to save the transaction on the database
• Rollback-used to restore the database to the original since the
last commit.
64
Interfaces
Form-based Interfaces
• A form-based interface displays a form to each user. Users fill out
all of the form entries to insert new data, or they can fill out
only certain entries. These types of forms are usually designed or
created and programmed for the users who have no expertise in
operating system. Many DBMS have forms specification
languages which are special languages that help specify such
form.
65
Menu Based Interfaces for Web clients
• These interfaces present the user with list of options (called
menus) that lead the user through the formation of a request.
66
Database Environment
What is a Database Environment?
• A database environment is a collective system of
components that comprise and regulates the group
of data, management, and use of data, which consist
of :
– Hardware
– Software
– People
– Procedures
– Data
67
Hardware
• It identifies all the system’s physical devices.
• The database system’s main and most easily
identified hardware component is the computer,
which might be a microprocessor, a minicomputer,
or a mainframe computer. It also include
peripherals like keyboard, mice, modems, printers,
etc.
68
Software
70
People
System Administrator: oversee the database system’s general
operations.
Database Administrator: manage the DBMS’s use and ensure that
the database is functioning properly.
Database Designers: design the database structure. They are in
effect the database architects. If the database design is poor, even
the best application programmers and the most dedicated DBAs will
fail to produce a useful database environment.
71
System Analysts and Programmers: design and implement the
application programs. They design and create the data entry
screens, reports, and procedures through which end user
access and manipulate the database’s data.
End Users: are the people who use the application programs to
run the organization’s daily operations. E.g. sales clerks,
supervisors, managers, and directors are all classified as end
users. High-level end users employ the information obtained
from the database to make tactical and strategic business
decisions.
72
Procedures
Procedures are the instructions and rules that govern the design
and use of the database system. Procedure are a critical,
although occasionally forgotten, component of the system.
Procedures play a very important role in a company, because they
enforce the standards by which business is conducted within the
organization and with customers. These also are used to ensure
that there is an organized way to monitor and audit both the data
and information.
73
Data
The word “data” covers the collection of facts stored in the
database. Because data are the raw material from which
information is generated, the determination of which data
are to be entered into the database and how such data are
to be organized is a vital part of the database designer’s
job.
74
DBMS Functions
• A DBMS performs several important functions that guarantee
the integrity and consistency of the data in the database.
Most of these functions are transparent to end users, and
most can be achieved only through the use of a DBMS.
75
Data dictionary management: The DBMS requires that
definitions of the data elements and their
relationships(metadata) be stored in a data dictionary. In
turn, all programs that access the data in the database
work through the DBMS. The DBMS uses the data
dictionary to look up the required data component
structures and relationships, thus relieving us
from having to code such complex relationships
in each program.
76
Data Storage Management: The DBMS creates the complex
structures required for data storage, thus relieving us from the
difficult task of defining and programming the physical data
characteristics. A modern DBMS system provides storage not only
for the data, but also for the related data entry forms or screen
definitions, report definitions, data validation rules, procedural
code, structures to handle video and picture formats, and so on.
77
Data transformation and presentation: the DBMS transforms
entered data to conform to the data structures that are required to
store data. Therefore, the DBMS relieves us of the chore of making
a distinction between the data logical format and the data physical
format. By maintaining the data independence, the DBMS
translates logical requests into commands that physically locate
and retrieve the requested data. That is, the DBMS formats the
physically retrieved data to make it confirm to the user’s logical
expectations.
78
Security Management: The DBMS creates a security system that
enforces user security and data privacy within the database.
Security rules determines which user can access the database,
which data items each user may access, and which data operations
the user may perform. This is especially important in multi user
database systems where many users can access the database
simultaneously.
79
Multi user access control: The DBMS creates the complex
structures that allow multi user access to the data. In order to
provide data integrity and data consistency, the DBMS uses
sophisticated algorithms to ensure that multiple users can
access the database concurrently without compromising the
integrity of the database.
80
Backup and recovery management: The DBMS provides backup
and data recovery procedures to ensure data safety and integrity.
Current DBMS system provide special utilities that allow the DBA
to perform routine and special backup and restore procedures.
Recovery management deals with the recovery of the database
after a failure, such as a bad sector in the disk or a power failure.
Such capability is critical to the preservation of the database’s
integrity.
81
Data Integrity Management: The DBMS promotes and enforces
integrity rules to eliminate data integrity problems, thus
minimizing the data duplicity and maximizing data consistency.
The data relationships stored in the data dictionary are used to
enforce data integrity. Ensuring data integrity is especially
important in transaction-oriented database systems.
82
Database access languages and application programming
interface: The DBMS provides data access via a query language. A
query language is a nonprocedural language – that is, one that
lets the user specify what must be done without having to specify
how it is to be done. The DBMS query language contains two
components: a DDL and DML. The DBMS also provides data access
to programmers via procedural languages. It also provides
administrative utilities used by the DBA and the database designer
to create, implement, monitor, and maintain the database.
83
Database communication interfaces: Current-generation DBMSs
provide special communications routines designed to allow the
database to accept end user requests within a computer network
environment. In fact, database communications capabilities are an
essential feature of the modern DBMS. E.g. the DBMS might provide
communications functions to access the database through the
Internet, using Internet browsers such as Netscape or Explorer as
the front end.
84
Components of a DBMS
• Query processor
• Database manager
• File manager
• DML preprocessor
• DDL compiler
• Catalog manager
Components of Database Manager
• Authorization control
• Command processor
• Integrity checker
• Query optimizer
• Transaction manager
• Scheduler
• Recovery manager
• Buffer manager
Database Management System (DBMS)
87
Database System Utilities
• To perform certain functions such as:
– Loading data stored in files into a database. Includes data
conversion tools.
– Backing up the database periodically on tape.
– Reorganizing database file structures.
– Report generation utilities.
– Performance monitoring utilities.
• Data dictionary / repository:
• Application Development Environments and CASE (computer-aided
software engineering) tools:
• Examples:
– PowerBuilder (Sybase)
– JBuilder (Borland)
– Oracle SQL Developer, JDeveloper 10G (Oracle) Slide 1- 88
DBMS Architecture
Types of DBMS Architecture
• There are three types of DBMS architecture:
• For example, lets say you want to fetch the records of employee
from the database and the database is available on your computer
system, so the request to fetch employee details will be done by
your computer and the records will be fetched from the database
by your computer as well.
Slide 1- 91
2. Two tier architecture
Logical two-tier client server architecture
Slide 1- 93
• In two-tier architecture, the Database system is present at the server machine
and the DBMS application is present at the client machine, these two machines
are connected with each other through a reliable network as shown in the above
diagram.
• Client manages main business and data processing logic and user interface,
server using a query language like sql, the server perform the request on the
• The application connection interface such as JDBC, ODBC are used for the
Slide 1- 96
• In three-tier architecture, another layer is present between the client
the database systems present at the server machine, rather the client
• Business logic and data processing layer – middle tier runs on a server
(application server).
• DBMS – stores data required by the middle tier. This tier may be on a
107