Professional Documents
Culture Documents
Chapter Two
Chapter Two
CHAPTER TWO
DATABASE ENVIRONMENT
(Architecture)
2. Database Environment
The three level ANSI-SPARC architecture
Since a database is shared resource by different users, each user may require a different view of the data
stored in the DB. To satisfy these needs, the architecture of most commercial DBMS’s available today is
based on standard called ANSI-SPARC architecture. American National Standard Institute (ANSI-
SPARC) recognizes the need for a three-level approach with a system catalog.
All the above and other functionalities are possible due to the three levels ANSI-SPARC architecture. The
three levels includes:-
1|Page
-SMU- Fundamentals of Database Systems
Chapter -2-Lecture Note
The following example can be taken as an illustration for the difference between the three levels
in the ANSI-SPARC database Architecture. Where:
The External level is concerned about the group of users and their respective data
requirement independent of the other.
The Conceptual level is describing the whole content of the database where one piece of
information will be represented once.
The Internal level describing the data structure of the physical data representation as in
the following diagram.
2|Page
-SMU- Fundamentals of Database Systems
Chapter -2-Lecture Note
The DBMS is responsible for mapping between these three of schema. It must also check
the schemas for consistency in other words;
o The DBMS must check that each external schema is derivable from the
conceptual schema to map between each external schema and internal schema.
o The three schemas are only description of data the only data that actually exists is
at the physical level.
In a DBMS, based on the three schema architecture, each user group refers only its own
external schema.
o Hence the DBMS must transform a request specified on an external schema in to
a request against the conceptual schema, and then in to a request on the internal
schema for processing over the stored database,
If the request is database retrieval, the data extracted from the stored DB
must be reformatted to match the user’s external view.
The process of transforming requests and results between levels are called
mappings.
In any data model it is important to distinguish between the description of the database and the
database itself.
The description of a database structure is called the database schema, which is specified
during DB design and is not expected to change frequently
The actual data in a database may change quite frequently.
o For example, a data in a student database, we add student or enter a new grade for
a student.
The data in the database at a particular moment in time is called a database state or
snapshot is called the current set of occurrences or instance in the database.
o In a given database state, each schema construct has its own current set of
instances.
3|Page
-SMU- Fundamentals of Database Systems
Chapter -2-Lecture Note
The student, construct will contain the set of individual student entries (records) as its
instance
o Many DB state can be constructed to correspond to a particular database schema.
o Every time we insert or delete a record,
we change the value of a data item in a record,
We change one state of the DB in to another state.
The distinction between schema and its DB state is very important when we define a new
database; we specify its database schema only to the DBMS.
o At this point, the corresponding database state is the empty state with no data.
o We get initial state of database when it is first populated or loaded with the initial
data.
Data independence
Which can be define as the capacity to change the schedule at one level of a database
system without having to change the schema at the next higher level
o A major objective for the three-level architecture is to provide data
independence which means that upper levels are unaffected by change to lower
levels
o there are two kinds of data independencies
logical data independence - is the capacity to change the conceptual
schema without having to change external schemas or application
program
physical data independence - is the capacity to change the internal
schema without having to change the conceptual schema
Database language
The DBMS must provide appropriate languages and interface to support each category of users.
Once the design of a database is completed and a specific DBMS is chosen to implement the
4|Page
-SMU- Fundamentals of Database Systems
Chapter -2-Lecture Note
database, the first order of the day is to specify conceptual and internal schemas for the
database and any mapping between the two.
Data Definition Language (DDL) - A descriptive language that allows the DBA and
database designer to specify the database schema or modify the existing one
Data Manipulation Language (DML) - Once the database schema is compiled and the
database is populated with data, users must have some means to manipulate the database.
Typically manipulations include retrieval, insertion, deletion and modification of the data
- There two types of DML :-
o High level or non-procedural
o Describe only what output is to be obtained
o A language that allows the user to state what data is needed rather than how it is to be
retrieved
o Fourth generation language (4GL)
o use query language(SQL)
o Low level or procedural
o Specify how the data output of DML statement must be obtained
Data Model
A Classification of data models
A specific DBMS has its own specific Data Definition Language, but this type of language is
too low level to describe the data requirements of an organization in a way that is readily
understandable by a variety of users. We need a higher-level language. Such a higher-level is
called data-model.
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.
Data
Data relationships
Data semantics
Data constraints
The main purpose of Data Model is to represent the data in an understandable way. Categories of
data models include:
Object-based
Record-based
Physical Record-based
5|Page
-SMU- Fundamentals of Database Systems
Chapter -2-Lecture Note
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 major data models includes:-
6|Page
-SMU- Fundamentals of Database Systems
Chapter -2-Lecture Note
7|Page
-SMU- Fundamentals of Database Systems
Chapter -2-Lecture Note
Relational model - allows the definition of data structure, storage and retrieval operation
and integrity constraints
in such database the data and relations between them are organized in tables
o Each tables has a number of columns( attribute ) with unique names
o use high-level query language called SQL and support a limited form of user
views
o It allows files to be related by means of a common field
o The relational database model is based on the mathematical concept of a relation,
which is physically represented as a table
o Relational data model employs three basic notations:
entity sets
relationship sets
attributes
o best features :-
allows a high degree of data independence
provide substantial grounds for dealing with data semantics,
consistency and redundancy problems
the development of structured query language
8|Page
-SMU- Fundamentals of Database Systems
Chapter -2-Lecture Note
9|Page