Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 24

Chapter 2 :

Database Environment

Batch: F-18IT
Subject: Database Systems

Course Facilitator:
Dr. Asghar Ali Chandio
Learning Outcomes
At the end of this chapter, students will be able to learn:
 The purpose of ANSI/SPARC Architecture
 The contents of the external, conceptual, and internal levels
 The purpose of the external/conceptual and the
conceptual/internal mappings
 The meaning of logical and physical data independence
 Data definition and data manipulation language
 A classification of data models
 The purpose and importance of conceptual modeling
 The typical functions and services that a DBMS should
provide
Objectives of Three-Level Architecture

 To separate each user’s view of the database from


the way the database is physically represented

 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.
Objectives of Three-Level Architecture

 DBA should be able to change database storage


structures without affecting the users' views.
 Internal structure of database should be
unaffected by changes to physical aspects of
storage.
 DBA should be able to change conceptual
structure of database without affecting all users.
ANSI-SPARC Three-Level Architecture

ANSI - American
National
Standards Institute
SPARC -
Standards
Planning and
Requirements
Committee
ANSI-SPARC Three-Level Architecture
 External Level
 The way users perceive the data.
 Describes that part of database that is relevant to a particular user.
 Conceptual Level
 Community view of the database.
 Describes what data is stored in database and relationships among
the data.
 Provides mapping and desired independence b/w external and
internal levels.
 Internal Level
 The way the DBMS and the OS perceive data.
 Physical representation of the database on the computer.
 Describes how the data is stored in the database.
Schemas, Mappings, and Instances
 The overall description of the database is called database
schema
 At the highest level, multiple external schemas (also called
subschemas) correspond to different views of the database
 At conceptual level, the conceptual schema describes all the
entities, attributes and the relationships together with the
integrity constraints
 At lowest level, the internal schema describes the internal
model, definition of stored records, method of representations,
data fields, indexes and storage structure
 The data in the database at any particular point in time is
called a database instance
 The schema is sometimes called the intension of the database;
an instance is called an extension (or state) of the database
Differences between Three Levels of
ANSI-SPARC Architecture
Data Independence and the ANSI-SPARC Three-
Level Architecture

Data Independence: structure of organization and


data format which are stored physically in storage
are independent from its application.

Specifically, data independence means changes


in storage structure and data access technique
does NOT affect application program.

Data independence means the upper levels in


three level architecture are unaffected by
changes to the lower levels
Data Independence and the ANSI-SPARC
Three-Level Architecture
Data Independence
 Logical Data Independence
 Refers to immunity of external schemas to changes in
conceptual schema.
 Conceptual schema changes (e.g. addition/removal of
entities).
 Should not require changes to external schema or rewrites
of application programs.
 Physical Data Independence
 Refers to immunity of conceptual schema to changes in the
internal schema.
 Internal schema changes (e.g. using different file
organizations, storage structures/devices).
 Should not require change to conceptual or external
schemas.
Database Languages
 Data Definition Language (DDL)
 Allows the DBA or user to describe and
name entities, attributes, and relationships
required for the application
 plus any associated integrity and security
constraints.
 DDL is used to specify the database schema
or to modify the existing schema
Database Languages
 Data Manipulation Language (DML)
 Provides basic data manipulation operations on data held in
the database
 Includes insertion, modification, retrieval and deletion of
records
 Procedural DML
 allows user to tell system exactly how to manipulate data
 Non-Procedural DML
 allows user to state what data is needed rather than how it is
to be retrieved
 Non-Procedural languages are also called as declarative
languages, SQL, QBE (Query-By-Example)
Database Languages
 Fourth Generation Language (4GL)
 4GL are non-procedural languages: user defines what is to be
done, not how
 Query Languages (SQL, QBE)
 Forms Generators: interactive for rapidly creating data input
and display layouts
 Report Generators: create reports from the data stored in the
database
» Language oriented and visually oriented
 Graphics Generators: display data in a graph such as bar
chart, pie chart, line chart, scatter chart etc.
 Application Generators: to produce a program that interfaces
with the database
Data Model

 Integrated collection of concepts for describing data,


relationships between data, and constraints on the
data in an organization

 Data Model comprises:


 a structural part;
 a manipulative part;
 possibly a set of integrity rules.

 Purpose
 To represent data in an understandable way.
Data Models
 Categories of data models include:
 Object-based
 Record-based
 Physical.

 Object-Based Data Models: use entities, attributes


and relationships
 Entity-Relationship
 Semantic
 Functional
 Object-Oriented.
Data Models
 Record-Based Data Models: DB consists of a number of
fixed format records
 Relational Data Model: based on the concepts of
mathematical relations
 Network Data Model: data is represented as
collections of records, and relationships are
represented by sets
 Hierarchical Data Model: can be represented as a tree
graph, with records appearing as nodes (also called
segments) and sets as edges.

 Physical Data Models: how data is stored in a computer


Data Models

Relational Model
Conceptual Modelling

 Conceptual schema is the core of a system supporting all


user views
 Should be complete and accurate representation of an
organization’s data requirements
 Conceptual modeling is process of developing a model of
information use that is independent of implementation
details
 Result is a conceptual data model
 Conceptual models are also called as logical models
Functions of a DBMS
 Data Storage, Retrieval, and Update: ability to store,
retrieve and update data in the database
 A User-Accessible Catalog: in which descriptions of
data items are stored and which is accessible to users
 Transaction Support: to ensure either all the updates
corresponding to a given transaction are made or that
none of them is made
 Concurrency Control Services: to ensure that the
database is updated correctly when multiple users are
updating the database concurrently
Functions of a DBMS

Concurrency control
Functions of a DBMS

 Recovery Services: to recover the database in the event that the


database is damaged in any way.
 Authorization Services: to ensure that only authorized users
can access the database.
 Support for Data Communication: must be capable of
integrating with communication software.
 Integrity Services: to ensure that both the data in the database
and changes to the data follow certain rules.
 Services to Promote Data Independence: must include
facilities to support the independence of programs from the
actual structure of the database.
 Utility Services: should provide a set of utility services.
Assignment - 2

 Explain the concept of database schema and discuss


the three types of schema in a database.

 What is a data model? Discuss the main types of


data model.

 What is a transaction? Give an example of a


transaction.

 What is concurrency control and why does a DBMS


need a concurrency control facility?
END OF CHAPTER 2

You might also like