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

MODELS OF

DATABASE AND
DATABASE DESIGN
LECTURE TWO
OBJECTIVES
By the end of this lecture students should
be able to (i) explain the difference
between a database instance and a
database schema;
(ii) describe the the 3 levels of abstraction
that were identified by the American
National Standards Institute Special
Planning and Requirements Committee
(ANSI-SPARC) and
(iii) define the term data independence
and identify the 2 types of data
independence that exist in relation to the
ANSI-SPARC Architecture.
Database Schema and Database
Instance
• Database Schema
• the description of the database is called
the database schema or intension;
• specified at the creation of the database
(using the Create Database or Create
Table statement)
• not expected to change very often
• Database Instance
• the raw data that populates a database
at a particular moment in time
Example of Database Schema and
Database Instance
Database schema (names of columns + the types associated with them)
Name DOB Address Job Scale
String Date String String Int
A database instance
Name DOB Address Job Scale
A. Johnson 2/04/1960 London Programmer 12
B. Holiday 3/10/1947 Leeds Analyst 14
C. Clark 12/08/1971 York Programmer 10
Why the ANSI SPARC Architecture?
• It allows independent customised user views; The Three
Level Architecture has the aim of enabling users to access
the same data but with a personalised view of it; Each user
should be able to access the same data, but have a
different customized view of the data. These should be
independent: changes to one view should not affect
others.
• It hides the physical storage details from users; The
distancing of the internal level from the external level
means that users do not need to know how the data is
physically stored in the database. This level separation also
allows the Database Administrator (DBA) to change the
database storage structures without affecting the users'
views.
The three ANSI/SPARC levels of
abstraction

View_1 View_2 View_3 View_n External Level

Conceptual level

Internal level

physical storage
EXTERNAL LEVEL
• It represents the user’s view of the
database
• It describes that part of the database
that is relevant to a particular user
• It excludes irrelevant data as well as data
which the user is not authorised to
access.
• May provide different representations of
the same data e.g some may view dates
in the form (day/month/year) or
(year/month/day)
• Views may include derived or calculated
data
CONCEPTUAL LEVEL
• Aka the community view of the database
• The conceptual level is a way of describing what
data is stored within the whole database and how
the data is inter-related but it does not specify how
the data is physically stored.
• It represents the following: all entities, their
attributes and relationships; the constraints on the
data; security and integrity information
• It supports each external view in that any data
available to a user must be contained in or
derivable from the conceptual level
• Only a database administrator is allowed to modify
or structure this level.
INTERNAL LEVEL
• The internal level involves how the database is physically
represented on the computer system. It describes how the
data is actually stored in the database and on the computer
hardware.
• It describes how the data is stored in the database in terms
of particular data structures and file organizations
• The internal level is the most technical of the three
levels. However, the internal level view is still abstract
meaning even if it shows how the data is stored physically,
it will not show how the database software operates on it.
• Is concerned with: allocating storage space for data and
indexes; describing the forms that records will take when
stored; record placement; data compression and encryption
techniques
•Below the internal level is the physical
level which is managed by the OS under
the direction of the DBMS and deals
with the mechanics of physically storing
data on a device such as a disk
Difference between External,
Conceptual and Internal Level

Accounts Office Students Registration Office


View View
RegNo, Name, Fees Paid RegNo, Name, Programme, Level

RegNo, Name, Fees Paid, Programme, Level

Create Table Students


(
RegNo varchar(15) UNIQUE NOT NULL,
Name varchar (20),
Fees Paid currency,
Programme varchar (20) UNIQUE,
Level int,
Primary Key (RegNo)
)
TYPES OF SCHEMAS
• There are three different types of schema corresponding to
the three levels in the ANSI-SPARC architecture.
• The punggung or external schemas which describe the
different external views of the data and there may be many
external schemas for a given database.
• The conceptual schema describes all the data items and
relationships between them, together with integrity
constraints (later). There is only one conceptual schema per
database.
• The internal schema at the lowest level contains definitions
of the stored records, the methods of representation, the
data fields, and indexes. There is only one internal schema
per database.
Data independence
• Data Independence refers to the ability to
change the schema at a lower level and the
changes do not affect the schema at a
higher level; of 2 types:
• Physical Data Independence
• This is the immunity of the conceptual
schema to changes at the internal level
• Logical Data Independence
• This is the immunity of the external
schema to changes at the conceptual
level
Representation of data
independence
View_1 View_2 View_3 View_n

Logical D
Independ
Conceptual level

Physical
Independ
Internal level

physical storage
THANK YOU
QUESTIONS????

You might also like