Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

-SMU- Fundamentals of Database Systems

Chapter -2-Lecture Note

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.

The purpose and origin of the Three-Level database architecture

 All users should be able to access same data.


o This is important since the database is having a shared data feature where all the data is
stored in one location and all users will have their own customized way of interacting
with the data.
 A user's view is unaffected or immune to changes made in other views. Since the requirement of
one user is independent of the other, a change made in one user’s view should not affect other
users.
 Users should not need to know physical database storage details. As there are naïve users of the
system, hardware level or physical details should be a black-box for such users.
 DBA should be able to change database storage structures without affecting the users' views.
o A change in file organization, access method should not affect the structure of the data
which in turn will have no effect on the users.
 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.
o In any database system, the DBA will have the privilege to change the structure of the
database, like adding tables, adding and deleting an attribute, changing the specification
of the objects in the database.

All the above and other functionalities are possible due to the three levels ANSI-SPARC architecture. The
three levels includes:-

1. External Level: Users' view of the database.


 This level describes that part of database that is relevant to a particular user.
o Different users have their own customized view of the database independent of other
users.
o It is often called as a view level which includes a number of external schemas or user
view of the data.
 Each external schema describes the part of the DB that a particular user group is interested in
and hides the rest of the DB from the user group.
 External schema also typically implemented using high level data model.

1|Page
-SMU- Fundamentals of Database Systems
Chapter -2-Lecture Note

2. Conceptual Level: Community view of the database.


 Describes what data is stored in database and relationships among the data.
 Conceptual schema hides the details of physical storage structures and concentrates on
describing entities, data type, relationships user operations and constraints.
 Describes all the data items and relationship between data items together with integrity
constraints
 The implementation of conceptual schema is often designed in high level data model.
3. Internal Level: Physical representation of the database on the computer.
 Describes how the data is stored in the database.
 It covers the data structure and organization used to store data on storage devices and the
complete description of the internal model.
The general ANSI-SPARC architecture is shown below.

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.

Schema, instance and Database state

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

Eg: - Schema diagram for student database

 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 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
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:-

 Hierarchical Data Model


 Network Data Model
 Relational Data Model
Hierarchical data model
The first hierarchical DBMS was developed by IBM and North America Aviation in the late
1960s.
 Uses two main data structuring concepts
 Record
 Parent child relationship (PCRs) –
o A record is a collection of field values that provide information on an entity (
relationships instance )
o Each field has certain data type
o A PCRs type: is one-to-many relationship between two records
o One side record type – parent record
o Many side record type – child record
 Properties of Hierarchical schema:-
o represents data as hierarchical tree structures –
o Each hierarchy represents a number of related records –
 Allows a node to have only one parents which means each child must
have one and only one parents
 Data is organized hierarchically just in the way data is organized in a file
cabinet
 Each relationship must be explicitly specified in the database created
 Record of the same type are grouped into record types
 One record type, called the root of the hierarchy doesn’t participate in any
PCR as a child record type.
 Every record, except the root, participates as a child exactly one PCR
type.
 A record type can participate as parent type in any number of PCR types
o Problem:-
 It is difficult to search for items in the bottom or middle of the hierarchy
 Are inflexible which is usually only a relatively small set of predefined
queries that can be applied to the data
 Inefficient at answering queries
 Inflexible and wholly unsuited to ad-hoc querying
 Many-to-many relationship is handled by duplication of record instances
Eg: Hierarchical model

6|Page
-SMU- Fundamentals of Database Systems
Chapter -2-Lecture Note

 Network model - It was an extension of the hierarchical data model –


o The differences are:
 In hierarchical data model, a child record has exactly one parent
 In network data model, a child can have any number of parents –
o It consists of two sets of structure
 Set of records
 Set of links - Each link type involves two record types, parent and child
record type
o Properties of network schema:-
 Each occurrence of a link represents
 A one-to-many (1:N) relationship between parents occurrence and
corresponding child occurrences.
 Defined to address some of the issues of inflexibility of the hierarchical
model
 There are minimal data independence
 Each child could have many parents
 There is no restriction on how many links can be combined into
link types.
 The child record type in one link can be the parents record type of
another link
 A given record type can be a parent in any number in any number
of link types.
 A given record type can be a child in any number of link types
except root
 Direct link make system implemented using network model is very
fast create relationship among data through a linked list structure in
which subordinates records( member) can be linked more than one
data element(owner)

7|Page
-SMU- Fundamentals of Database Systems
Chapter -2-Lecture Note

 use index ( unique number) for searching item


 Problem:- - the developers must anticipated every possible question that
users might ask about the data - increase complexity
 need huge amount of processor time and storage space due to
fragmentation of data
 flexibility does come at the great complexity and duplication of
data

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

 The strength of the relation database is a designer does not need to


know which questions might be asked of the database. If the data is
carefully defined the database can answer virtually any question

9|Page

You might also like