You are on page 1of 24

DATABASE SYSTEMS

COMSATS University, Islamabad


Abbottabad Campus
Computer Science Department

Mukhtiar Zamin,
MS (Computer Science)
Iowa, United States of America
mukhtiar@ciit.net.pk

Lecture 3 - DBMS Architecture, ANSI-SPARC architecture, Objectives, Database Schema, Languages and Data Models 1
Lecture 3
• DBMS Architecture
• The Three-Level ANSI-SPARC Architecture
– External Level
– Conceptual Level
– Internal Level
– Physical Data Organization
• Differences between Three Levels of ANSI-SPARC Architecture
• Objectives of Three-Level Architecture
• Database Schema
• Data Independence
• Database Languages
• Data Models and Conceptual Modeling
– Object Based Data Model
– Record-based Data Models
– Physical Data Models
• Conceptual Modeling
Lecture 3 - DBMS Architecture, ANSI-SPARC architecture, Objectives, Database Schema, Languages and Data Models 2
DBMS Architecture
• A major aim of a database system is to provide users
with an abstract view of data, hiding certain details of
how data is stored and manipulated.
• The starting point for the design of a database must be
an abstract and general description of the information
requirements of the organization that is to be
represented in the database.
• A database is a shared resource, each user may require a
different view of the data held in the database. To satisfy
these needs, the architecture of most commercial
DBMSs available today is based to some extent on the
so-called ANSI-SPARC architecture.
Lecture 3 - DBMS Architecture, ANSI-SPARC architecture, Objectives, Database Schema, Languages and Data Models 3
The Three-Level ANSI-SPARC Architecture
• The American National Standards Institute (ANSI) Standards
Planning and Requirements Committee (SPARC) produced this
architecture in 1975 (ANSI, 1975).

• It comprising an external, a conceptual and an internal level


– External level: The way users perceive the data
– Internal level: The way the DBMS and the operating system perceive
the data, where the data is actually stored using the data structures
and file
– Conceptual level: Provides both the mapping and the desired
independence between the external and internal levels.

• The objective of the three-level architecture is to separate each


user’s view of the database from the way the database is physically
represented.

Lecture 3 - DBMS Architecture, ANSI-SPARC architecture, Objectives, Database Schema, Languages and Data Models 4
External Level
• Describes that part of the database that is
relevant to each user.
• Users’ view of the database.
• Describes that part of database that is
relevant to a particular user.
• A user may require few attributes and may
not need rest of the attributes.

Lecture 3 - DBMS Architecture, ANSI-SPARC architecture, Objectives, Database Schema, Languages and Data Models 5
Conceptual Level
• Describes what data is stored in database and
relationships among the data.
• The community view of the database.
• It contains logical structure of the database
• It represents:
– All entities, attributes and their relationships
– Constraints on data
– Semantic information about the data
– Security and integrity of data

• It does not concern any storage considerations, such as


how many bytes occupied.

Lecture 3 - DBMS Architecture, ANSI-SPARC architecture, Objectives, Database Schema, Languages and Data Models 6
Internal Level
• Physical representation of the database on the
computer
• Describes how the data is stored in the database.
• It covers following things:
– Storage space allocation for data and indexes
– Record descriptions for storage (size)
– Record placement
– Data compression and encryption techniques

Lecture 3 - DBMS Architecture, ANSI-SPARC architecture, Objectives, Database Schema, Languages and Data Models 7
Physical Data Organization
• Below the internal level is the Physical Level.
• This level is maintained by the Operating
System under the direction of the DBMS.
• Examples :
– Fields are stored contiguously on disk or not.

Lecture 3 - DBMS Architecture, ANSI-SPARC architecture, Objectives, Database Schema, Languages and Data Models 8
Differences between Three Levels
of ANSI-SPARC Architecture

Lecture 3 - DBMS Architecture, ANSI-SPARC architecture, Objectives, Database Schema, Languages and Data Models 9
Objectives of Three-Level Architecture

• Same data accessible to all users.


• A user’s view is immune to changes made in other
views.
• Hide physical database storage details from users.
• 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.

Lecture 3 - DBMS Architecture, ANSI-SPARC architecture, Objectives, Database Schema, Languages and Data Models 10
Database Schema
• The description of overall database is called
database schema.
– External Schema
• Corresponds to different views of data
– Conceptual Schema
• Describes entities, attributes, relationships and constraints.
– Internal Schema
• It is a complete description of the internal model, including
definitions of records, indexes and hashing functions.

Lecture 3 - DBMS Architecture, ANSI-SPARC architecture, Objectives, Database Schema, Languages and Data Models 11
Data Independence
• Major objective of three level architecture is to provide data
independence.
• Upper levels are unaffected when changes are made in the low levels.
• There are two kinds of data independences
• 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 require changes to external schema or rewrites of
application programs.
– Physical Data Independence
– Refers to immunity of conceptual schema to changes in the
internal schema.
– Internal schema changes (e.g. using different file
organizations, storage structures/devices).
– Should not require change to conceptual or external schemas.
Lecture 3 - DBMS Architecture, ANSI-SPARC architecture, Objectives, Database Schema, Languages and Data Models 12
Data Independence

Lecture 3 - DBMS Architecture, ANSI-SPARC architecture, Objectives, Database Schema, Languages and Data Models 13
Database Languages
• Consists of two parts a Data Definition Language (DDL) and Data
Manipulation Language (DML).

• Do not include constructs for all computing needs such as


conditional or iterative statements

Lecture 4 - Database Schema, Data Independence, Database Languages, Dataa Models, Conceptual Modeling 14
Data Definition Language (DDL)
• Used to specify the database schema

• A language that allows the DBA or user to describe and name the entities,
attributes, and relationships required for the application, together with
any associated integrity and security constraints.

• The result of the compilation of the DDL statements is a set of tables


stored in special files collectively called the system catalog. The system
catalog integrates the metadata, that is data that describes objects in the
database and makes it easier for those objects to be accessed or
manipulated.

CREATE database MyDatabaseName


OR
CREATE TABLE Employee (ID int NOT NULL, LoginID nvarchar(100) NOT NULL,
JobTitle nvarchar(200) NOT NULL, …. )

Lecture 4 - Database Schema, Data Independence, Database Languages, Dataa Models, Conceptual Modeling 15
Data Manipulation Language (DML)
• A language that provides a set of operations to support the basic data
manipulation operations on the data held in the database.
• Data manipulation operations include:
– Retrieval/Selection
• SELECT * FROM Employee
– Insertion
– Modification
– Deletion
• Procedural DML
– Allows user to tell system what data is needed and exactly how to retrieve data.
– Retrieves a record, processes it and, based on the results, retrieves another record that
would be processed similarly, and so on.
• Non-Procedural DML
– Allows user to state what data is needed rather than how it is to be retrieved.
– Single retrieval or update statement.

Lecture 4 - Database Schema, Data Independence, Database Languages, Dataa Models, Conceptual Modeling 16
Data Models
• A model is a representation of ‘real world’ objects and events, and their
associations.
• Data Model
– Integrated collection of concepts for describing data, relationships between data, and
constraints on the data in an organization.
OR
– Graphical systems used to capture the nature and relationships among data

• The purpose of a data model is to represent data and to make the data
understandable. If it does this, then it can be easily used to design a database.

• Categories of data models include:


– Object-based
– Record-based
– Physical.
• Describe Data at internal level
– Both object and record based describe Data at Conceptual and External Levels

Lecture 4 - Database Schema, Data Independence, Database Languages, Dataa Models, Conceptual Modeling 17
Object Based Data Model
• Object based models use concepts like entities, attributes
and relationships
• Some of the more common types of object-based data
model are:
– Entity–Relationship Model
• Forms the basis for the database design methodology
– Semantic Model
– Functional Model
– Object-Oriented Model

• Entity is a distinct object such as a person, thing, place etc


in the organization that is to be represented.
• Attribute is the property that describe some aspects of the entity.
• Relationship is an association between entities.
Lecture 4 - Database Schema, Data Independence, Database Languages, Dataa Models, Conceptual Modeling 18
Record-based Data Models
• In this model, database consists of a number of fixed format records
and each record has a fixed number of fields.

• There are three principal types of record-based logical data model


– Relational model
– Network model
– Hierarchical model.

• The hierarchical and network data models were developed almost a


decade before the relational data model, so their links to traditional
file processing concepts are more evident.

Lecture 4 - Database Schema, Data Independence, Database Languages, Dataa Models, Conceptual Modeling 19
Record-based Data Models
Relational Data Model
• This model is based on mathematical relations.
• Data and Relationships are represented by tables
• Each table has a number of columns with unique names.

Lecture 4 - Database Schema, Data Independence, Database Languages, Dataa Models, Conceptual Modeling 20
Record-based Data Models
Network Data Model
• Data is represented as collection of records and relationships are represented as sets.
• These sets become pointers in the implementations.
• Records are organized as graph structures
– Nodes are records
– Sets as edges

Lecture 4 - Database Schema, Data Independence, Database Languages, Dataa Models, Conceptual Modeling 21
Record-based Data Models
Hierarchical Data Model
• Restricted type of Network Model
• Data is represented as collection of records and relationships are represented as sets.
• It allows a node to have only one parent
• It is represented by a tree graph
– Records as nodes also called Segments
– Sets as Edges

Lecture 4 - Database Schema, Data Independence, Database Languages, Dataa Models, Conceptual Modeling 22
Physical Data Models
• Describe how data is stored in the computer,
representing information such as record
structures, record orderings, and access paths.
There

Lecture 4 - Database Schema, Data Independence, Database Languages, Dataa Models, Conceptual Modeling 23
Conceptual Modeling
• In three-level architecture, we see that the
conceptual schema is the ‘heart’ of the database.
• The process of constructing a model of the
information use in an enterprise that is
independent of implementation details, such as
the target DBMS, application programs,
programming languages, or any other physical
considerations.
• Also referred to as logical models in the literature
Lecture 4 - Database Schema, Data Independence, Database Languages, Dataa Models, Conceptual Modeling 24

You might also like