Database Systems
LECTURE #:04
M. Shafiq
FACULTY OF CS & IT
UNIVERSITY OF GUJRAT
Database Environment
End users
Software interact
Application Programs Application
Programmers
develop
“What” to get
DBMS Database
maintain Administrators
“How” to get
Data
Database
Database design Designers
Users
Database Terminologies
Database Schema: The description of a database.
Includes descriptions of the database structure and
the constraints that should hold on the database.
The database schema changes very infrequently.
Database Instance: The actual data stored in a
database at a particular moment in time. Also
called database state (or occurrence).
3
Database Terminologies
Database State: Refers to the content of a
database at a moment in time. The database state
changes every time the database is updated.
Initial Database State: Refers to the database
when it is loaded
Valid State: A state that satisfies the structure and
constraints of the database.
Schema Diagram: A diagrammatic display of
(some aspects of) a database schema
4
ANSI Architecture
User 1 User 2 User 3
External External
External Schemas
View 1 View 2
External/Conceptual Mappings
Conceptual DBA
Conceptual Schema View
Conceptual/Internal Mapping
Internal Schema Stored
Data
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.
6
Why 3-Level Architecture
Each user should be able to access the same data, but
have a different customized view of data. Each user
should be able to change the way he or she views the data,
and this change should not affect other users.
User should not have to deal directly with physical
database storage details.
The internal structure of the database should be
unaffected by the changes to the physical aspects of
storage, such as change over to a new storage devices.
Three-Schema Architecture
Defines DBMS schemas at three levels:
Internal schema at the internal level to describe
physical storage structures and access paths. Typically
uses a physical data model.
Conceptual schema at the conceptual level to describe
the structure and constraints for the whole database for
a community of users. Uses a conceptual or an
implementation data model.
External schemas at the external level to describe the
various user views. Usually uses the same data model
as the conceptual level.
8
Three-Schema Architecture
9
Three-Schema Architecture
10
External Level
This Level Describes- The Part of Database that is relevant
to each user e.g. Registration, Accounts etc
Calculated Data: That is not actually stored in the database
but is created when needed e.g. age
DBMS uses external views to create users interface for
different users which is both the facility and barrier.
External Schema are evolves as user needs are modified
over time
11
External Level
First Name: Rana Name: R. Aslam
Last Name: Aslam User A Age: 24y,10d
Date of Birth: Dept: Sales
12 Sep, 1970
User B
Corresponds to different views of Data
Conceptual / Logical View
Entire information structure of the database.
Also called “The Community view of data”
The definitions of conceptual view of total database contents
All entities, attributes and their relationships are represented.
Representing data and constraints on data
Contains information about the security and integrity information
Relatively constant: designed with the present as well as future needs
of an organization.
13
Conceptual / Logical View
First Name: Rana Name: R. Aslam
Last Name: Aslam Age: 24y,10d
Date of Birth: Dept: Sales
12 Sep, 1970
Name DoB DepId
Rana Aslam 12/09/70 D001
Marya Wasti 29/02/80 D005
Describes all entities their attributes their relationships with constraints
Internal View
A low level representation of entire database
Although these are at same level but
Internal View
Internal Record: a single stored record
Does not just contain what we see at the conceptual
level
Physical View
Actual Data (on the disk) binary format.
Use OS to store the Data
15
Internal View
First Name: Rana Name: R. Aslam
Last Name: Aslam Age: 24y,10d
Date of Birth: Dept: Sales
12 Sep, 1970
Name DoB Deps DepId
Rana Aslam 12/09/70 5 D001
Marya Wasti 29/02/80 0 D005
RH Rana Aslam 120970 5 D001 RH Marya Wasti…
0110011010011100101001010100101010010101….
.
Contains stored Data (Record)
Three-Schema Architecture
Mappings among schema levels are needed
to transform requirements and data.
Programs refer to an external schema, and
are mapped by the DBMS to the internal
schema for execution.
17
Mappings
External to logical model
Specifies mapping between objects in the
external view to those in the logical
model
Logical to Physical
Specifies mapping between objects in the
logical model to those in the physical
model-data independence
18
Three-Schema Architecture
19