Fundamentals of Database Management Systems (Cosc2041) : Chapter Two Database System Architecture
Fundamentals of Database Management Systems (Cosc2041) : Chapter Two Database System Architecture
Systems
(CoSc2041)
Chapter Two
2
The ANSI-SPARC Architecture
The following architecture is a standard designed by ANSI and is applicable to
most modern database systems.
The architecture is composed of three levels:
a) Internal Level
b) Conceptual Level
c) External Level
3
The ANSI-SPARC Architecture…
a) Internal Level
That is, it is concerned with the way the data is physically stored.
It is the way the DBMS and the Operating system perceive the data.
It is concerned with how fields are represented, what physical
sequence the stored records are in, …
It deals with assembly and similar language commands.
4
The ANSI-SPARC Architecture…
b) Conceptual/Logical level
It is the community view of the database as seen by the DBA.
This is the next-higher level of abstraction next to internal level that
describes what data are stored in the database, and what relationships
exist among those data.
It includes Entity-Relationship modeling, security and integrity
constraints.
Although implementation of the simple structure at the logical level
may involve complex physical-level structures, the user of the logical
level does not need to be aware of this complexity.
The logical level of abstraction is used by database administrators, who
must decide what information should be kept in the database.
5
The ANSI-SPARC Architecture…
c) External/View level
The highest level of abstraction describes only some part of the
entire database.
It is concerned with how individual users view the database.
Despite the use of simpler structures at the logical level, some
complexity remains.
Because of the large size of the database, many users of the database
system will not be concerned with all this information.
Instead, such users need to access only a part of the database. So that
their interaction with the system is simplified and the view level of
abstraction is defined.
The system provides many views for the same database.
6
The ANSI-SPARC Architecture…
For Example
7
Schemas and Instances
Schema
Is the overall description of the database, include explanation of the
database constraints that should hold on the database.
The three level of schema according their abstraction: entity describes
External schema: at the external level to describe the various
user views.
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.
Internal schema: at the internal level to describe physical storage
structures and access paths.
8
Schemas and Instances…
Instances
is the collection of data in the database at a particular point of
time.
Also called State or Snap Shot or Extension of the database
State of database is changed any time we add, delete or update an item.
Since Instance is actual data of database at some point in time, changes
rapidly.
Mappings
The DBMS is responsible for mapping between the 3 types of schema.
The conceptual schema is related to the internal schema through a Conceptual/Internal mapping.
Each External schema is related to the conceptual schema by the External/Conceptual mapping
9
Schemas and Instances…
The contents of the external, conceptual and internal levels The
purpose of the external/conceptual and the conceptual/internal
mappings
10
Data Independence…
The ability to modify a schema definition in one level
without affecting a schema definition in the next higher
level is called data independence.
11
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
12
Data Independence…
•Physical Data Independence
The ability to modify the physical schema without changing the
logical schema
The capacity to change the internal schema without having to change
internal schema
In general, the interfaces between the various levels and components
13
Database Languages
SQL languages fall into three broad categories:
Data Definition Language (DDL),
Data Manipulation Language (DML),
Data Control Language (DCL) and
Transaction Control Language (TCL)
14
Database Languages…
•Data Definition Language (DDL)
Allows DBA or user to describe and name entitles, attributes
and relationships required for the application.
Specification notation for defining the database schema
15
Database Languages…
DML can be procedural or non-procedural
Procedural DML: user specifies what data is required and how
it is to be retrieved
SQL is the most widely used non-procedural language query
language
Fourth Generation Language (4GL)
Query Languages
Forms Generators
Report Generators
Graphics Generators
Application Generators
16
Database Languages . . .
Data Manipulation Language
Data Definition Language (DDL) (DML)
Used to specify a database scheme Data Manipulation Language, or
as a set of definitions expressed in Data Management Language)
a DDL statement. A language for the manipulation
DDL Statements: of data in a database.
CREATE DATABASE DML Statement:
CREATE TABLE INSERT INTO
ALTER TABLE UPDATE
DROP DATABASE SELECT
DROP TABLE RENAME
TRUNCATE database/table DELETE
Etc. Etc.
17
Database Languages . . .
Transaction Control Language
Data Control Language (DCL) (TCL)
18
Data Model
19
Data Model…
•Data Model is a collection of tools or concepts for describing
Data
Data relationships
Data semantics
Data constraints
20
Data Models
What is a database models?
It is a representation of real world objects and events and their associations.
It’s a data model that describes in an abstract way how data is represented in an
information system or a database management system.
The term model is ambiguous, since it can cover:
How data is organized logically
How data is organized, physically
How data is accessed by the end user
Database model can be divided into four:
Hierarchical database model
Network database model
Relational database model
Object-oriented database model
21
Hierarchical Database Model
The simplest data model
Record type is referred to as node or segment
22
Hierarchical Database Model…
Consists of an ordered set of trees in a parent child mode.
Records are represented by rectangles.
Allows a node to have only one parent.
It has two data structure concepts:
Records and PCR (parent child relationship).
1-1 or 1-M link is allowed.
Connection between child and its parent is called a Link.
23
Hierarchical Database Model…
Advantages c
The hierarchical model is a relatively simple
CSIT Department
one – which is its main strength.
It is therefore particularly adapted to large,
simple databases.
E.g. Family Tree Problem
Marc Sarma
Disadvantage
We must write a program
Addition, deletion, and search operations are
very difficult.
There is duplication of data. Binyam Zecharias Binyam Zecharias
Records are ordered.
Complex programming is required.
24
Network Database Model
It is an extension of the hierarchical model
Allows record types to have more that one parent unlike hierarchical
model
A network data models sees records as set members
linked records.
Allow member records to have more than one owner
25
Network Database Model…
Advantages Cc
Easy to show the connection of
items.
Good for network type problem. CSIT Department
Disadvantages
Complexity problem.
Addition, deletion, search Binyam Zecharias
operations are difficult.
Programming is required.
26
Relational Database Model
The main difference with the previous two models is that this
one gets rid (free) of physical pointers and of all the ensuing
limitations.
27
Relational Database Model…
The basic guiding principles in a relational data model are:
Relation: a table with columns and rows.
Attribute: it is a named column of a relation.
Domain: is the set of allowable values for one or more attributes.
Tuple: it is a row of a relation.
Degree: is the number of attributes in a relation.
Cardinality: is the number of row in a relation.
Relational Database: is a collection of normalized relations with
distinct relation name.
All of this might seem a bit abstract – let’s look at the following concrete
example to make things clearer:
28
Relational Database Model…
C
Cc
29
Relational Database Model…
The spreadsheet data above can be C
linked to the relational data model
concepts in the following way: Cc
The entire spreadsheet above is a
relation, which we could call
“Student-Status”.
Thedomains (or data types) for the values in the tuples must be atomic,
which means that:
Allowed are: elementary data types such as text strings, integers,
dates, etc…
Not allowed are: tuples, lists, sets, etc…
31
Relational Database Model…
Relations in an RDBMS are described using what is called a schema
– the name of the relation, a tuple with its attributes and their
respective data types.
The schema for our example above could be: Student-Status (Name
text string, Father-Name text string, Birth-Year integer, Academic-
Status text string)
Strengths & Weaknesses
It is simple to understand.
It is highly flexible and easy to use search and access times are
relatively slow – slower, in any case, than in the previous two data
models.
32
Relational Database Model…
Properties of Relational Databases
A column or combination of columns that matches the primary key of
another table is called a foreign key. Used to cross-reference tables.
The referential integrity rule of the model states that, for every
foreign key value in a table there must be a corresponding primary key
value in another table in the database or it should be NULL.
33
Relational Database Model…
Properties of Relational Databases
A table is either a BASE TABLES (Named Relations) or VIEWS
(Unnamed Relations)
Only Base Tables are physically stores
VIEWS are derived from BASE TABLES with SQL instructions like:
34
Relational Database Model…
Properties of Relational Databases
Order of rows and columns is immaterial
Entries with repeating groups are said to be un- normalized
35
Building Blocks of the Relational Data Model
36
Object Database Model
A data model is a logic organization of the real world objects (entities),
constraints on them, and the relationships among objects.
A core object-oriented data model consists of the following basic
object-oriented concepts:
Object and object identifier: Any real world entity is uniformly modeled as an
object
Attributes and methods: every object has a state and a behavior (the set of
methods - program code - which operate on the state of the object). The state and
behavior encapsulated in an object are accessed or invoked from outside the object
only through explicit message passing.
37
Thank You!
Question?
38