0% found this document useful (0 votes)
5 views

Unit I Data Models

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Unit I Data Models

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 42

Data Models and Architecture

of DBMS
By
Dr. Rifaqat Ali
Department of Mathematics and Scientific Computing
National Institute of Technology Hamirpur
Email id : [email protected]
Schema:
A schema is plan of the database that give the names of the entities
and attributes and the relationship among them.
A schema includes the definition of the database name, the record
type and the components that make up the records.
Alternatively, it is defined as a frame-work into which the values of
the data items are fitted.
The values fitted into the frame-work changes regularly but the
format of schema remains the same.
For Example: Consider the database consisting of three files ITEM,
CUSTOMER and SALES.
There are two types of Schema:
The logical schema: provides the conceptual view that defines the
relationship between the data entities.
Any changes made in logical schema have minimal effect in the physical
schema.
Logical schema includes attributes.
Examples: Entity Relationship diagram, Unified Modeling Language, class
diagram.
The physical schema: describes the way of storage of data in the disk.
Changes in Physical schema effects the logical schema.
Physical schema does not include attributes.
Examples: Data definition language(DDL), storage structures, indexes.
Subschema: is a subset of the schema having the same properties
that a schema has.

Instances: The data in the database at a particular moment of time is


called an instance or a database state.
Three Level Architecture of Database Systems (DBMS):

• The architecture is a framework for describing database


concepts and specifying the structure of database system.
• The three level architecture was suggested by ANSI/SPARC.
• The database is divided into three levels:
i. External level
ii. Conceptual level
iii. Internal level
(i) Internal Level:
 This level describes the actual physical storage of data.
 This level is not relational because data is stored according to
various coding schemes instead of tabular form.
 This is the low level representation of entire database.
 The internal level is concerned with the following aspects:
– Storage space allocation
– Access paths
– Data compression and encryption techniques
– Record placement
(ii) Conceptual Level:
 The conceptual level is also known as logical level.
 It describes the overall logical structure of whole database for a
community of users.
 This level is relational because data visible at this level will be
relational tables and operators will be relational operators.
 This level represents entire contents of the database in an abstract
form in comparison with physical level.
 The conceptual schema is defined which hides the actual physical
storage and concentrate on relational model of database.
(iii) External Level:

The external level is concerned with individual users.


This level describes the actual view of data seen by individual
users.
 The external schema is defined by the DBA for every user.
 The remaining part of database is hidden from that user. This
means user can only access data of its own interest.
 In other words, user can access only that part of database for
which he is authorized by DBA.
There are two types of mappings:
1. Conceptual/Internal mapping
2. The External/Conceptual mapping
Mappings: the process of transforming requests and results among the
three levels are called mappings. It is of two types.

1. Conceptual/Internal Mapping: This mapping defines the


correspondence or operations between the conceptual view
and the physical view.
 It specifies how the data is retrieved from physical storage and
shown at conceptual level and vice-versa.
 It specifies how conceptual records and fields are represented at
the internal level.
 It also allows any differences in entity names, attribute names
and their orders needs to be resolved.
2. External/Conceptual Mapping: This mapping defines the
correspondence between the conceptual view and the
physical view.
 It specifies how the data is retrieved from conceptual level and
shown at external level because at external level some part of
database is hidden from a particular user and even names of
data fields are changed.
Advantages of Three-level Architecture:

Each user is able to access the same data but have a different
customized view of the data as per the requirement.
The changes to physical storage organization does not affect the
internal structure of the database.
e.g., moving the database to a new storage device
To use the database, the user is no need to concern about the physical
data storage details.
The conceptual structure of the database can be changed by the DBA
without affecting any user.
The database storage structure can be changed by the DBA without
affecting the user’s view.
Data Independence:
It is defined as the characteristics of a database system to
change the schema at one level without having to change the
schema at the next higher level.
It can also be defined as the immunity of the application
programs to change in the physical representation and access
techniques of the database.
The above definition says that the application programs do not
depend on any particular physical representation or access
technique of the database.
The data independence is of Two types: Physical and Logical
Physical Data Independence:
 The physical storage structures used for storing the data could
be changed without changing the conceptual view or any of the
external views.
 Only the mapping between the conceptual and internal level is
changed.
Logical Data Independence:
 The conceptual schema can be changed without changing the
existing external schemas.
 Only the mapping between the external and conceptual level is
changed and absorbed all the changes of the conceptual
schema.
Data Models
• A data model is used to describe the structure of the database
including data types, relationships and the constraints that apply
on the data.
• A data model helps in understanding the meaning of the data
and ensures in the following way:
The data requirements of each user.
The use of data across various applications.
The nature of data independent of its physical representations.
• A data model supports communication between the users and
database designers.
Characteristics of Data Models:

Diagrammatic representation of the data model.


Simplicity in designing i.e., Data and their relationships can be
expressed and distinguished easily.
Application independent, so that different applications can share
it.
Data representation must be without duplication.
Bottom-up approach must be followed.
Consistency and structure validation must be maintained.
Types of Data Models:

Data models can be divided into three categories


 Record Based Data Models
 Object Based Data Models
 Physical Data Models
(i) Record Based Data Models:
 These models represent data by using the record structures.
 These models lie between the object based data models and the
physical data models.
Further categorised into three types
a) Hierarchical Data Model
b) Network Data Model
c) Relational Data Model
a) Hierarchical Data Model
• Hierarchical Data Model is one of the oldest database models.
• The hierarchical model became popular with the introduction of IBM’s
Information Management System (IMS).
• The hierarchical data model organizes records in a tree structure i.e., hierarchy
of parent and child records relationships.
• This model is based on mainly two concepts i.e., Record and Parent Child
Relationship.
• A record is a collection of field values that provide information of an entity.
• A Parent Child Relationship type is a 1 : N relationship between two record
types.
• The record type of one side is called the parent record type and the one on the
N side is called the child record type.
Continued…

 The major advantages of


Hierarchical Model are that it is
simple, efficient, maintains data
integrity and is the first model that
provides the concept of data
security.
 The major disadvantages of
Hierarchical model are that it is
complex to implement, Lacking of
structural independence and data
management problem.
b) Network Data Model
• As a result of limitations in the hierarchical model, designers developed the
Network Model.
• The ability of this model to handle many to many (N : N) relations between
its records is the main distinguishing feature from the hierarchical model.
• Thus, this model permits a child record to have more than one parent.
• In this model, directed graphs are used instead of tree structure in which a
node can have more than one parent.
• This model was basically designed to handle non-hierarchical relationships.
Continued…
• There are two basic data structures in this model: Records
and Sets.
• The record contains the detailed information regarding the
data which are classified into record types.
• A set type represents relationship between record types
and this model use linked lists to represent these
relationships.
• Each set type definition consists of three basic elements : a
name for set type an owner record type (like parent) and a
member record type (like child).
Contd…

 Advantages: it is conceptually simple, Handles more


relationship types, promotes database integrity, data
access flexibility and conformance to the standards.
 Disadvantages: it is complex and lack of structural
independence.
c) Relational Data Model
• The Relational Model was first introduced by Dr. Edgar Frank, an Oxford-
trained Mathematician, while working in IBM Research Centre in 1970’s.
• The main significance of the model is the absolute separation of the logical
view and the physical view of the data.
Continued…

• In this model, the data is represented in the form of tables which is used
interchangeably with the word Relation.
• Each table consists of rows also knowns as tuples (A tuple represents a
collection of information about an item, e.g., student record) and column
also known as attributes. (An attribute represents the characteristics of an
item, e.g., Student’s Name and Phone No.).
Advantages: it is structurally independent, improved conceptual simplicity
adhoc query capability and powerful DBMS.
Disadvantages: are substantial hardware and software overhead and
facilitates poor design and implementation.
(ii) Object Based Data Models: These models are used in
describing the data at the logical and user view levels.
These models allow the users to implicity specify the constraints
in the data.
Further categorised into four types:
a) Entity Relationship Model (ER-Model)
b) Object Oriented Model
c) Semantic Data Model
d) Functional Data Model
a) Entity Relationship Model (ER-
Model)
• The E-R model is a high level conceptual data model developed by Chen in
1976 to facilitate database design.
• The E-R model is the generalization of earlier available commercial model
like the hierarchical and network model.
• It also allows the representation of the various constraints as well as their
relationships.
• Advantages: it is conceptually simple, an effective communication tool and
can be integrated with the relational data model.
• Disadvantages: there are limited constraint representation, limited
relationship representation, no data manipulation language and loss of
information content.
b) Object Oriented Model
• It is a logical data model that captures the semantics of objects supported in
an object-oriented programming.
• It is based on collection of objects, attributes and relationships which together
form the static properties.
• An object is a collection of data and methods. When different objects of same
type are grouped together they form a class. This model is used basically for
multimedia applications as well as data with complex relationships.
Advantages: Capability to handle various data types, improved data access,
and improved productivity.
Disadvantages: Not suitable for all applications, No precise definition, and
Difficult to maintain.
c) Semantic Data Model
• These models are used to express greater interdependencies among
entities of interest.
• These interdependencies enable the models to represent the semantic of
the data in the database.

d) Functional Data Model

• The functional data model describes those aspects of a system concerned with
transformation of values-functions, mappings, constraints and functional
dependencies.
Comparison of Various Data Models
(iii) Physical Data Models: These models provide the concepts that
describes the details of how the data is stored in the computer along
with their record structures, access paths and ordering.
Further divided into two types:
a) Unifying Model: is expressed as Unified Modeling Language (UML).
Class diagrams to capture the logical structure of a domain as a set
of classes, their features (attributes), and the relationships
(associations) between them.
b) Frame Memory Model: is a virtual view of secondary storage that
can be implemented with reasonable overhead to support database
record storage and accessing requirements.
Note that: Only specialized or professional users can use these models.
Database Languages:
 The generalized database language, which is common in all databases, is
Structured Query Language (SQL).
 It is divided into the following four parts: DDL, DML, DCL, and TCL
1. Data Definition Language (DDL): The database language which is used to
define database objects; to drop database objects; to alter (change) database
objects, such as tables, views, users, is known as Data Definition Language
(DDL).
For example:
 DDL to create a ZONE table.
Create table zone (zoneid integer, zonename char(20));
 DDL to alter a ZONE table which changes the data type of a zoneid from
integer to char(1).
Alter table zone modify column zoneid char(1);
 DDL to drop (delete) a ZONE table.
Drop table zone;
Continued….
2. Data Manipulation Language (DML): The database language, which is
used to insert data, manipulate data; delete data or retrieve data in tables or
views, is known as Data Manipulation Language (DML).
For example:
 DML to insert data in a ZONE table.
Insert into zone values(1, ‘North’);
 DML to change the value of zonename from ‘North’ to ‘East’ for
zoneid = 1.
Update zone set zonename = ‘East’ where zoneid = 1;
 DML to delete a record of zoneid 1 from ZONE table.
Delete from zone where zoneid = 1;
 DML to retrieve a record of zoneid 1 from ZONE table.
Select * from zone where zoneid = 1;
Continued….

3. Data Control Language (DCL): The database language which is used to


control data access is known as Data Control Language (DCL).
The Grant and Revoke commands are used to assign
insert/delete/update/select privileges or access of specific data.
For example:
DCL to assign insert privilege on table ZONE table to user ‘shefali’. To
grant or revoke privileges the user himself should have privileges or rights
to assign privileges to other users.
Grant Insert on zone to ‘shefali’;
Continued…

4. Transaction Control Language (TCL): The database language which is


used to control transactions is known as transaction control language (TCL).
For example: The checkpoint and savepoint commands are used to control
transactions.

Note that: Data Sub Language (DSL): The combination of Data Definition
Language and Data Manipulation Language is known as Data Sub Language
(DSL).
Difference between Data Independence and Structural Independence:

 Data independence: When we can change the data type or


size of any field without changing the application program
 Structural independence: When we can change the structure
of any table without changing the application program
 Note: Data and structural independence is provided by
database systems, but 100% data or structural independence
is not possible.
Database Interfaces:
• A DBMS interface is a user interface which allows for the ability to
input queries to a database without using the query language itself.
• It provides a mechanism through which user can interact with the
database without using query language (like SQL).
Types of database interfaces
1) Menu-based interfaces for web client or Browsing
2) Graphical user interfaces
3) Form-based interfaces
4) Natural language interfaces
5) Speech input and output interfaces
1) Menu-based interfaces for web client or Browsing:
 These interfaces present the user list of options called menus.
User chooses from menus or look through the content of the database for
specific objects using a browser.
2) Graphical User interfaces (GUI):
GUI display a schema to the user in diagrammatic form.
User selects options or specify queries by pressing a key or pointing to
certain parts of the displayed schema diagram.
GUI can also use both menu and form-based interfaces.
3) Form-based interfaces:
These display a forms to each user (naïve user).
User can insert or access data from database with the help of these forms.
DBMS have forms specification languages to support form-based interfaces.
4) Natural language interfaces:
These interfaces accept requests written in common language
generally in English.
Natural language interfaces can range from simple commands to
voice activated text processing.
5) Speech input-output interfaces:
In this interface, there is a use of speech to input query and
speech as an output to a question or result of request.
Applications with a limited vocabularies such as inquiries for
telephone directory, flight arrival/departure, bank account
information allow speech for input and output of query.
References:

1. An introduction to database concepts by B. Desai, Galgotia


publications.
2. An introduction to database systems by C. J. Date, Addison Wesley.
3. Fundamentals of database systems by Elmsari and Navathe, Addison
Wesley.
4. Database System Concepts by Abraham Silberschatz, Henry F.
Korth and S. Sudarshan, McGraw-Hill.
5. CONCEPTS OF DATABASE MANAGEMENT SYSTEM by SHEFALI NAIK,
Pearson.

You might also like