Você está na página 1de 14

Database Management Systems

Unit 2

Unit 2

Database Core Concepts and


Applications

Structure
2.1 Introduction
Objectives
2.2 Data Model, Schemas and Instances
The Three-Schema Architectures
Data Independence
2.3 Database Languages and Interfaces
DBMS Languages
DDL
Data Manipulation Languages (DMLs)
DBMS Interfaces
2.4 DBMS Component Modules
Stored Data Manager
Query processor
DDL compiler
Run-time data base Processor
Pre-compiler
Database System Utilities
2.5 Classification and Criterion of Database Management Systems
2.6 Summary
2.7 Terminal Questions
2.8 Answers

2.1 Introduction
A database model is a theory or specification describing how a database is
structured and used. Several such models like Hierarchical model, Network
model, Relational model etc., have been suggested.
Objectives
To know about
Define Data Model, Schemas and Instances
Describe DBMS Architecture and Database Independence
Explain Database Languages and Interfaces
Sikkim Manipal University

Page No.: 13

Database Management Systems

Unit 2

Explain DBMS Languages


Describe DBMS Interfaces
Explain Classification of Database Management Systems.

2.2 Data Model, Schemas and Instances:


Data Model

Concepts used in
a Data Model

Schemas

Instances

It is a set of Concepts for viewing a set of data in a structured


way.
This can be easily understood by professionals and non-technical
users.
It can explain the way in which the organization uses and
manages the information.
Entity
An entity is something that has a distinct, separate existence,
though it need not be of a material existence.
E.g. - Employee.
Attribute
It is the property that describes an entity
It is a characteristic or property of an object, such as weight, size,
or color
Relationship
Describes the relationship between two or more entities
The description of the data base means defining the names, data
type, size of a column in a table and database [actual data in the
table] itself.
The description of a database is called the database schema [or
the Meta data].
Description of a database is specified during database design and
is not frequently changed.
Roll No.
Name
Semester
Branch
The collection of data stored in the database at a particular
moment is a database instance or database state or snapshot.
These changes very frequently due to addition, deletion and
modification.
Roll No.
Name
Semester
Branch
1
Rajesh Prabhu
ii
E&C

Sikkim Manipal University

Page No.: 14

Database Management Systems

Unit 2

Self Assessment Question


1. Define Database model. List some Data Models.
2.2.1 The Three-Schema Architecture
The Three-schema Architecture has three levels of architecture, an internal
level, a Conceptual level and an External level. The three schema
architecture is also referred as Client Server Architecture. In this
architecture the major advantages lies in that, the division of the architecture
into levels allows both developers and users to work on their own levels.
They do not need to know the details of the other levels AND they do not
have to know anything about changes in the other levels. Note that each of
these schemas are only descriptions of data; the data really only exists at
the physical level.
1. Internal level

This is a description of the physical storage structure of the database

Operations performed here are translated into modifications of the


contents and structure of the files

It has an internal schema.

It describes the complete details of the stored records and access


methods used to achieve efficient access to the data.

2. Conceptual level

This hides the details of physical


concentrates on describing entities.

This level is independent of both software and hardware.

storage

structures

and

3. External level or view level

This is outermost layer

This layer is closest to the users.

The data viewed by the individual users is called External level.

Sikkim Manipal University

Page No.: 15

Database Management Systems

EXTERNAL
VIEW

Unit 2

External
View

External
View

Mappings
CONCEPTUAL
LEVEL

Conceptual Schema

Mappings

Internal Schema
INTERNAL
LEVEL

STORED DATABASE
Fig. 2.1: The Three-Schema Architecture

2.2.2 Data independence:


Data independence is defined as the ability to modify a schema definition in
one level without affecting a schema definition in a higher level.
There are two kinds:
1. Physical data independence:
This is the ability to modify the physical scheme without causing application
programs to be rewritten. Modifications at this level are usually to improve
performance.
2. Logical data independence:
This is the ability to modify the conceptual scheme without causing
application programs to be rewritten. This is usually done when the logical
structure of database is altered. Logical data independence is harder to
achieve, as the application programs are usually heavily dependent on the
logical structure of the data. An analogy is made to abstract data types in
programming languages.
Sikkim Manipal University

Page No.: 16

Database Management Systems

Unit 2

Self Assessment Questions


2. Explain the concepts used in the Data Model.
3. Define Schema and Instances and give one example for each.
4. Explain 3-tier Architecture with a neat diagram.
5. Define Data independence and also distinguish between Physical
and Logical data independence.

2.3 Database Languages and Interfaces

As a database supports a number of user groups, DBMS must have


languages and interfaces that support each of these user groups.

2.3.1 DBMS Languages


2.3.1.1 DDL the data definition language, used by the DBA and
database designers to define the conceptual and internal schemas.

The DBMS has a DDL compiler to process DDL statements in order to


identify the schema constructs, and to store the description in the
catalogue.

In databases where there is a separation between the conceptual and


internal schemas, DDL is used to specify the conceptual schema, and
SDL, storage definition language, is used to specify the internal schema.

For true three-schema architecture, VDL, view definition language, is


used to specify the user views and their mappings to the conceptual
schema. But in most DBMSs, the DDL is used to specify both the
conceptual schema and the external schemas.

2.3.1.2 Data Manipulation Languages (DMLs)

Data Manipulation Language (DML) is a family of computer languages


used by computer programs or database users to retrieve, insert, delete
and update data in a database.

Currently, the most popular data manipulation language is that of SQL,


which is used to retrieve and manipulate data in a Relational database.

Other forms of DML are those used by IMS/DL1, CODASYL databases


(such as IDMS), and others.

Data manipulation languages were initially only used by computer


programs, but (with the advent of SQL) have come to be used by people
as well.

Sikkim Manipal University

Page No.: 17

Database Management Systems

Unit 2

Data manipulation languages have their functional capability organized


by the initial word in a statement, which is almost always a verb. In the
case of SQL, these verbs are "select", "insert", "update", and "delete".

Data manipulation languages tend to have many different "flavors" and


capabilities between database vendors.

There has been a standard established for SQL by ANSI, but vendors
still "exceed" the standard and provide their own extensions.

Two main types of DML:


High-level/Non procedural

Can be used on its own to specify complex database operations.

DMBSs allow DML statements to be entered interactively from a


terminal, or to be embedded in a programming language.

If the commands are embedded in a general purpose programming


language, the statements must be identified, so they can be extracted by
a pre-compiler and processed by the DBMS.

High-level DMLs, such as SQL can specify and retrieve many records in
a single DML statement, and are called set at a time or set oriented
DMLs.

High-level languages are often called declarative, because the DML


often specifies what to retrieve, rather than how to retrieve it.

Low Level/Procedural

Must be embedded in a general purpose programming language.

Typically retrieves individual records or objects from the database and


processes each separately.

Therefore it needs to use programming language constructs such as


loops.

Low-level DMLs are also called record at a time DMLS because of this.

2.3.1.3 DBMS Interfaces


Types of interfaces provided by the DBMS include:
Menu-Based Interfaces for Web Clients or Browsing:
Present users with lists of options (menus)
Lead user through formulation of request
Query is composed of selection options from menu displayed by system.
Sikkim Manipal University

Page No.: 18

Database Management Systems

Unit 2

Forms-Based Interfaces:

Displays a form to each user.

User can fill out a form to insert new data or fill out only certain entries.

Designed and programmed for nave users as interfaces to canned


transactions.

Graphical User Interfaces:


Displays a schema to the user in diagram form. The user can specify a
query by manipulating the diagram. GUIs use both forms and menus.
Natural Language Interfaces:

Accept requests in written English or other languages and attempt to


understand them.

Interface has its own schema, and a dictionary of important words. Uses
the schema and dictionary to interpret a natural language request.

Interfaces for Parametric Users:

Parametric users have a small set of operations they perform.

Analysts and programmers design and implement a special interface for


each class of nave users.

Often a small set of commands are included to minimize the number of


keystrokes required. (I.e. function keys)

Interfaces for the DBA:

Systems contain privileged commands only for DBA staff.

Includes commands for creating accounts, setting parameters,


authorizing accounts, changing the schema, reorganizing the storage
structures etc.

Self Assessment Questions


6. Define DDL. How it is processed?
7. What do you mean by DML? Explain.
8. Explain different types of DML.
9. Explain different types of DBMS interfaces and also write down
interfaces for DBA.

Sikkim Manipal University

Page No.: 19

Database Management Systems

Unit 2

2.4 DBMS Component Modules

2.4.1 Stored Data Manager:


Most important component of a DBMS

Controls access to DBMS information stored on disk

It is responsible for interfacing with file system.

Converts User's queries coming directly through the query processor to


a physical file system.

Sikkim Manipal University

Page No.: 20

Database Management Systems

Unit 2

Synchronizing of the simultaneous operations performed by concurrent


users is controlled by the data manager.
It maintains consistency and integrity of the data
It is responsible for back up and recovery, Concurrency control, security
and integrity.

2.4.2 Query processor:


It is used to convert online user's query into an efficient series of
operations and send it to the data manager for execution
It uses data dictionary to find the structure of schema object [tables,
index, and stored procedures].
2.4.3 DDL compiler:
It processes schema definitions specified in the DDL and stores
descriptions of the schema [Metadata] in the DBMS catalog.
The catalogue includes information such as names of the files, data
items, storage details of each file and constraints.
2.4.4 Run-time data base processor:
It handles database access at run time.
It receives retrieval or update operations and carries them out on the
database.
2.4.5 Pre-compiler:
DML commands from an application program written in a host
programming language are extracted from a Pre-Compiler.
These commands are sent to the DML compiler for compilation into
object code for database access. The rest of the program is sent to the
host language compiler.
2.4.6 Database System Utilities DBA in managing the database system.
UTILITY

FUNCTION

Load

Loads data from data file into the database

Backup

Creates a backup copy of the database

File reorganization

Helps to reorganize a database file into a different


file organization.

Performance monitoring

Helps to monitor database usage by providing


statistics to the DBA

Sikkim Manipal University

Page No.: 21

Database Management Systems

Unit 2

Self Assessment Question(s) (SAQs) (for section 2.4)


10. Explain the functionality of Database Manager.
11. Write a note on Query processor, DDL Compiler, Run-time database
processor, pre-compiler.

2.5 Classification and Criterion of Database Management


Systems
Several criteria are normally used to classify DBMS.
A. Based on Data model
B. Based on number of users
C. Based on number of sites.
A. Based on Data model: It specifies a particular mechanism for data
storage and retrieval. The primary difference between the different
database models lies in the methods of expressing relationships and
constraints among the data elements. Five database models are
discussed here:
1. Hierarchical Model: It is one of the oldest database models [1950s],
and represents data as hierarchical tree structures.
2. Network Model: It represents data as record types, and has an
ability to handle many-to-many relationships.
3. Relational Model: Relational models stores data in the form of a
table. Data is interrelated; relationships link rows from two tables.
End-users need not know about physical data storage details. So it
is conceptually simple.
A relational database is data driven, not design driven. It is designed
once, and the data changes over time without affecting the
applications. Data is stored once, so maintaining consistency
among all applications is easier.
The presence of powerful query language (SQL) is one of the main
reasons for the immense popularity of the relational database model;
it allows the user to specify what must be done, without specifying
how it must be done. A Relational model is based on mathematical
theory, whose principles were laid down by Dr. E. F. Codd. The
relational model uses a collection of tables to represent both data
and the relationships among those data. 'Codd' provides a set of 12
rules, which qualify a database product as relational.
Sikkim Manipal University

Page No.: 22

Database Management Systems

Unit 2

4. Object Oriented model: It is based on a collection of objects.


Object oriented database manages objects, and is suited for
multimedia applications as well as data with complex relationships
that are difficult to model and process in a relational DBMS. Object
Oriented Data Base Management System [OODBMS] holds data,
text, pictures, voice and video.
OODBMS contains 'values stored in instance variables and methods
or functions which controls the behavior of the variables.
OOP concepts such as inheritance, polymorphism and dynamic
binding features improve productivity.
5. Object-relational model: It is a combination of both objects oriented
concepts and relational concepts. It combines the advantages of
modern object oriented programming languages, which provide
facility for the users to define new data type and functions of their
own. Relational database is not only useful for storing data, but also
provides business rules that are applied to the data. Associating
rules with data makes the data more active, enabling the database
system to perform automatic validity checks to automate many
business procedures. It supports specialized applications such as
image retrieval, searching, multimedia, etc.
Eg. 1: IBM's DB2 universal server, oracle 8 and SQL server 7 and so
on.
B. Based on number of users: It is based on number of users supported
by the system. Single user system supports only one user at a time and
multi-user system supports multiple users concurrently.
C. Based on number of sites: A DBMS is centralized if the data is stored
at a single computer site. A DBMS is distributed if the data and DBMS
software are distributed over many sites, connected by a computer
network.
Self Assessment Questions
12. What are the criteria used for classification of DBMS?
13. ________ is used to convert online user's query into an efficient series
of operations and send it to the data manager for execution
A. Query processor
B. DDL compiler
Sikkim Manipal University

Page No.: 23

Database Management Systems

Unit 2

C. Run-time data base processor


D. Pre-compiler
14. ________ processes schema definitions specified in the DDL and stores
descriptions of the schema [Metadata] in the DBMS catalog
A. Query processor
B. DDL compiler
C. Run-time data base processor
D. Pre-compiler
15. ________ Handles database access at run time
A. Query processor
B. DDL compiler
C. Run-time data base processor
D. Pre-compiler
16. DML commands from an application program written in a host
programming language is extracted from a
A. Query processor
B. DDL compiler
C. Run-time data base processor
D. Pre-compiler

2.6 Summary
In this chapter we have studied about the basic concepts of DBMS like Data
Model, Schemas and Instances, The Three-Schema Architectures, Data
independence, DBMS Interfaces, DBMS Components, Data Manager,
Query processor, DDL compiler, Run-time data base processor, and
Pre-compiler. We have also studied about Database System Utilities. We
have also studied about various classifications of database like Hierarchical
Model, Network Model, Relational Model Object and Oriented model.

2.7 Terminal Questions


1. Define data model and discuss the categories of data models. (2.2)
2. Write a note on schemas. (2.2)
3. Write a note on data Independence. (2.3.2)
4. What is the difference between logical data independence and physical
data independence? (2.3.2)
Sikkim Manipal University

Page No.: 24

Database Management Systems

Unit 2

2.8 Answers
Self Assessment Questions
1. A database model is a theory or specification describing how a database
is structured and used. There are several such models like Hierarchical
model, Network model, Relational model etc. (Refer section 2.1)
2.
Entity

Attribute

Relationship

An entity is something that has a distinct, separate


existence, though it need not be of a material existence.
E.g. - Employee.
It is the property that describes an entity
It is a characteristic or property of an object, such as
weight, size, or color
Describes the relationship between two or more entities

3.
Schemas

The description of the data base means


defining the
names, data type, size of a column in a table and database
[actual data in the table] itself.
The description of a database is called the database
schema [or the Meta data].
Description of a database is specified during database
design and is not frequently changed.
Roll No.
Name
Semester
Branch

Instances

The collection of data stored in the database at a particular


moment
is a database instance or database state or
snapshot.
The changes very frequently due addition, deletion and
modification.
Roll No.
Name
Semester
Branch
1
Rajesh Prabhu
ii
E&C

(Refer section 2.2)


Sikkim Manipal University

Page No.: 25

Database Management Systems

Unit 2

4. (Refer to section 2.2.1)


5. (Refer to sections 2.2.2, 2.2.2.1 and 2.2.2.2)
6. (Refer section 2.3.1.1)
7. (Refer section 2.3.1.2)
8. (Refer section 2.3.1.2)
9. (Refer section 2.3.1.3)
10. (Refer section 2.4.1)
11. (Refer sections 2.4.2, 2.4.3, 2.4.4, 2.4.5)
12. (Refer Section 2.5)
13. A
14. B
15. C
16. D
Terminal Questions
1. (Refer section 2.2)
2. (Refer section 2.2)
3. (Refer section 2.2.2)
4. (Refer section 2.2.2)

Sikkim Manipal University

Page No.: 26

Você também pode gostar