You are on page 1of 47

CS220 Database Systems

Lecture # 2

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 1


Database Environment

Chapter 2

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 2


Objectives of Three-Level
Architecture
➢ Allusers should be able to access same data
but have a different customized view
➢ A user’s view is immune to changes made in
other views
➢ Users should not need to know physical
database storage details

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 3


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
12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 4
ANSI-SPARC Three-Level
Architecture

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 5


ANSI-SPARC Three-Level
Architecture..
➢ External Level
❖ Users’ view of the database
❖ Describes that part of database that is relevant to a
particular user
❖ Different views may have different representation of same
data (e.g. different date formats, age derived from DOB
etc.)

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 6


ANSI-SPARC Three-Level
Architecture..
➢ Conceptual Level
❖ Community view of the database
❖ Describes what data is stored in database and
relationships among the data
❖ Along with any constraints on data

❖ Independent of any storage considerations

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 7


ANSI-SPARC Three-Level
Architecture..
➢ Internal Level
❖ Physical representation of the database on the computer
❖ Describes how the data is stored in the database

❖ physical implementation of the database to achieve


optimal runtime performance and storage space
utilization
❖ Data structures and file organizations used to store data
on storage devices
❖ Interfaces with the operating system access methods to
place the data on the storage devices, build the indexes,
retrieve the data, and so on
12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 8
Differences between Three Levels of ANSI-SPARC
Architecture

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 9


Schemas
➢ External Schemas
❖ Also called subschemas
❖ Multiple schemas per database

❖ Corresponds to different views of data

➢ Conceptual Schema
❖ Describes all the entities, attributes, and relationships
together with integrity constraints
❖ Only one schema per database

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 10


Schemas..
➢ Internal Schema
❖ A complete description of the internal model, containing
the definitions of stored records, the methods of
representation, the data fields, and the indexes and
storage structures used
❖ Only one schema per database

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 11


Mappings
➢ The DBMS is responsible for mapping
between these three types of schema:
❖ The DBMS must check that each external schema is
derivable from the conceptual schema, and it must use the
information in the conceptual schema to map between
each external schema and the internal schema
➢ Types of mappings
❖ Conceptual/Internal mapping
❖ External/Conceptual mapping

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 12


Conceptual/Internal Mapping
➢ Enables the DBMS to
❖ Find the actual record or combination of records in
physical storage that constitute a logical record in the
conceptual schema,
❖ Together with any constraints to be enforced on the
operations for that logical record
❖ It also allows any differences in entity names, attribute
names, attribute order, data types, and so on, to be
resolved

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 13


External/Conceptual Mapping
➢ Enables the DBMS to
❖ Map names in the user’s view on to the relevant part of
the conceptual schema

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 14


Instances
➢ Database Schema
❖ Description of database (also called intension)
❖ Specified during design phase

❖ Remain almost static

➢ Database Instance
❖ Data in the database at any particular point in time
❖ Dynamic (changes with the time)

❖ Also called an extension (or state) of database

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 15


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

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 16


Data Independence
➢ 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, storage devices etc.)
❖ Should not require change to conceptual or external
schemas

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 17


Data Independence and the ANSI-SPARC
Three-Level Architecture

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 18


Database Languages
➢ Data sublanguage consist of two parts:
❖ DDL (Data Definition Language)
❖ DML (Data Manipulation Language)

➢ Data sublanguage
❖ Does not include constructs for all computing needs such
as iterations or conditional statements
❖ Many DBMSs provide embedding the sublanguage in a
high level programming language e.g. C, C++, Java etc.
❖ In this case , these high level languages are called host
languages

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 19


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
➢ System catalog (data dictionary, data
directory)
➢ Metadata (data about data, data
description, data definitions)
12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 20
Data Manipulation Language (DML)
➢ Provides basic data manipulation
operations on data held in the database
❖ Procedural DML
❖ Non-Procedural DML

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 21


Procedural DML
➢ Allows
user to tell system exactly how to
manipulate data
❖ Operate on records individually
❖ Typically, embedded in a high level language
❖ Network or hierarchical DMLs
❖ More work is done by user (programmer)

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 22


Non-Procedural DML
➢ Allows user to state what data is needed
rather than how it is to be retrieved
❖ Operate on set of records
❖ Relational DBMS include e.g. SQL, QBE etc.
❖ Easy to understand and learn than procedural DML
❖ More work is done by DBMS than user
❖ Provides considerable degree of data independence
❖ Also called declarative languages

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 23


Fourth Generation Languages (4GLs)

➢ No clear consensus
❖ Forms generators
❖ Report generators
❖ Graphics generators
❖ Application generators
❖ Examples : SQL and QBE

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 24


Functions of a DBMS
➢ Data storage, retrieval, and update

➢ A user-accessible catalog

➢ Transaction support

➢ Concurrency control services

➢ Recovery services
12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 25
Functions of a DBMS..
➢ Authorization services

➢ Support for data communication

➢ Integrity service

➢ Services to promote data independence

➢ Utility services
12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 26
DBMS Environment
➢ Single user

➢ Multi-user

❖ Teleprocessing

❖ File-Server Architecture

❖ Client-Server Architecture

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 27


Teleprocessing

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 28


Teleprocessing
➢ Traditional architecture

➢ Single mainframe with a number of


terminals attached

➢ Trend is now towards downsizing

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 29


File-Server Architecture

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 30


File-Server Architecture
➢ DBMS and applications run on each
workstation
➢ Disadvantages include:
❖ Significant network traffic
❖ Copy of DBMS on each workstation

❖ Concurrency, recovery and integrity control more


complex because multiple DBMSs accessing same files

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 31


Client-Server Architecture

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 32


Client-Server Architecture
➢ Client (tier 1) manages user interface and
runs applications
➢ Server (tier 2) holds database and DBMS

➢ Advantages include:
❖ Wider access to existing databases
❖ Increased performance

❖ Possible reduction in hardware costs

❖ Reduction in communication costs

❖ Increased consistency
12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 33
Two-Tier Client-Server

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 34


Three-Tier Client-Server
➢ Clientside issues in two-tier client/server
model preventing true scalability:
❖ ‘Fat’ client, requiring considerable resources on client’s
computer to run effectively
❖ Significant client side administration overhead

➢ By 1995, three layers proposed, each


potentially running on a different platform

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 35


Three-Tier Client-Server

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 36


Three-Tier Client-Server
➢ Advantages:
❖ ‘Thin’ client, requiring less expensive hardware
❖ Application maintenance centralized

❖ Easier to modify or replace one tier without affecting


others
❖ Separating business logic from database functions makes
it easier to implement load balancing
❖ Maps quite naturally to Web environment

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 37


Data Model
➢ Integrated collection of concepts for
describing data, relationships between data,
and constraints on the data in an
organization

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 38


Purpose of Data Model
➢ To represent data in an understandable way
❖ Represents the organization itself
❖ Helps in unambiguous and accurate communication
between between database designers and end-users about
their understanding of the organizational data

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 39


Components of a Data Model
➢ A data model comprises:
❖ A structural part
❖ A manipulative part

❖ Possibly a set of integrity rules

❖ ANSI-SPARC architecture related models


▪ External data model (Universe of Discourse)
▪ Conceptual data model (DBMS independent)
▪ Internal data model

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 40


Categories of Data Models
➢ Categories of data models include:
❖ Object-based
▪ Entity-Relationship
▪ Semantic
▪ Functional
▪ Object-Oriented

❖ Record-based
▪ Relational Data Model
▪ Network Data Model
▪ Hierarchical Data Model

❖ Physical
12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 41
Relational Data Model

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 42


Network Data Model

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 43


Hierarchical Data Model

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 44


Conceptual Modeling
➢ Conceptual modeling is process of
developing a model of information use in an
enterprise that is independent of
implementation details
❖ Should be complete and accurate representation of an
organization’s data requirements
❖ Conceptual schema is the core of a system supporting all
user views
➢ Conceptual vs. logical data model
12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 45
Summary
➢ Components of the DBMS environment
➢ Roles in the DB environment

➢ History of DBMS

➢ Advantages/Disadvantages of DBMSs

➢ ANSI-SPARC three-level architecture

➢ Schemas, mappings, and instances

➢ Data independence
12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 46
Summary
➢ Database languages
➢ Functions of a DBMS

➢ DBMS environment

➢ Data models and their categories

12/01/2022 12:37 PM faiqa.maqsood@superior.edu.pk 47

You might also like