0% found this document useful (0 votes)
13 views22 pages

Unit - 1.2

Chapter 2 covers key concepts in database systems, including data models, schemas, and the three-schema architecture. It explains the types of data models (conceptual, representational, physical), the structure and purpose of schemas, and the importance of data independence. Additionally, it discusses database languages, interfaces, and the overall environment of a database management system.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views22 pages

Unit - 1.2

Chapter 2 covers key concepts in database systems, including data models, schemas, and the three-schema architecture. It explains the types of data models (conceptual, representational, physical), the structure and purpose of schemas, and the importance of data independence. Additionally, it discusses database languages, interfaces, and the overall environment of a database management system.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Chapter 2

Unit 1
Database System Concepts and Architecture: Data Models, Schemas, and
Instances - Three-Schema Architecture and Data Independence - Database
Languages and Interfaces - The Data base System Environment - Centralized
and Client/Server Architectures for DBMSs.
Data Models
 A Data Model in Database Management System (DBMS) is the concept of tools that
are developed to summarize the description of the database.
 A collection of concepts that can be used to describe the structure of a database.
 Data Models provide us with a transparent picture of data which helps us in creating
an actual database.
 It shows us from the design of the data to its proper implementation of data.
 Data models define how the logical structure of a database is modeled.
 Data Models are fundamental entities to introduce abstraction in a DBMS.
 Data models define how data is connected to each other and how they are processed
and stored inside the system.

 It is basically classified into 3 types: -


o Conceptual Data Model (High level Data Model)
o Representational Data Model (Implementational Level Data Model)
o Physical Data Model (Low Level Data Model)

o 1. Conceptual Data Model:


o The conceptual data model describes the database at a very high level and is
useful to understand the needs or requirements of the database.
o It is this model that is used in the requirement-gathering process i.e. before the
Database Designers start making a particular database.
o Example:One such popular Conceptual Data model is the entity/relationship
model (ER model). The E/R model specializes in entities, relationships, and even
attributes that are used by database designers.
o Entity-Relationship Model:
o Entity-Relationship (ER) Model is based on the notion of real-world entities and
relationships among them. While formulating real-world scenario into the
database model, the ER Model creates entity set, relationship set, general
attributes and constraints.
o ER Model is best used for the conceptual design of a database.
o ER Model is based on −
 Entities and their attributes.
 Relationships among entities.
o These concepts are explained below.

o Components of ER Model:
 Entity: An entity is referred to as a real-world object. It can be a name,
place, object, class, etc. These are represented by a rectangle in an ER
Diagram.
 Attributes: An attribute can be defined as the description of the entity.
These are represented by Eclipse in an ER Diagram. It can be Age, Roll
Number, or Marks for a Student.
 Relationship: Relationships are used to define relations among different
entities. Diamonds and Rhombus are used to show Relationships.
o 2. Representational Data Model:
o This type of data model is used to represent only the logical part of the database
and does not represent the physical structure of the database.
o 3. Physical Data Model :
o Provide concepts that describe the details of how data is stored in computer
system, such as record formats, orderings of records, access paths (indexes).
o An access path is a structure that makes the search for particular database records
efficient.
Schemas
 Schema is the overall description of the database. The basic structure of how the data
will be stored in the database is called schema.
 A database schema is the skeleton structure that represents the logical view of the
entire database. It defines how the data is organized and how the relations among
them are associated. It formulates all the constraints that are to be applied on the
data. (or)
 A database schema is the logical representation of a database, which shows how
the data is stored logically in the entire database. It contains list of attributes and
instruction that informs the database engine that how the data is organized and how
the elements are related to each other.

Figure 1: Example for Database Schema


Figure 2:Another Example for Database Schema

 In actual, the data is physically stored in files that may be in unstructured form, but to
retrieve it and use it, we need to put it in a structured form. To do this, a database
schema is used. It provides knowledge about how the data is organized in a database
and how it is associated with other data.

 It can be categorized into three parts. These are:


o Physical Schema
o Logical Schema
o View Schema

Figure 3: Categories of Database Schema


 A physical schema can be defined as the design of a database at its physical level. In
this level, it is expressed how data is stored in blocks of storage.
 A logical schema can be defined as the design of the database at its logical level. In
this level, the programmers, as well as the database administrator (DBA), work. At
this level, data can be described as certain types of data records that can be stored in
the form of data structures. However, the internal details (such as an implementation
of data structure) will be remaining hidden at this level.
 View schema can be defined as the design of the database at the view level, which
generally describes end-user interaction with database systems.

Note 1: Difference between Schema and State:

 Database State:
o Refers to the content of a database at a moment in time.
o Initial Database State:
o Refers to the database state when it is first populated or loaded with initial
data.
o Valid State:
o A state that satisfies the structure and constraints specified in the schema.
 Distinction
o The database schema changes very infrequently.
o The database state changes every time the database is updated.
o Schema is also called intension.
o State is also called extension.
Figure 4: Example for Database State

Note 2: Difference between Data model and Data Base Schema

 Data Model is a high level design which defines the kind of tables, the fields in those
tables and the relations between different tables. Database schema describes the
type(int, string etc) and constraints like length of field should be less than 20
characters.
Instances
 The situation where a data or information is stored in the database at a particular
moment of time is called an instance.
 In a database, there will be many read, and write operations. So we can't say we have
content in the database as the data in the database is changing frequently.
 So,Instance in DBMS represents the data/information present in the database at
a particular instance/time.
 Let's say we have a STUDENT table, below is the representation of the table on 16th
May.Suppose a new student is enrolled in the university on 17th May. Now the
database will be updated and this is shown below.

 Now, if we say we need instance of STUDENT table on 16th May, Table present at
the left will be returned.
 But, when we say we need instance of STUDENT table on 17th May, Table present
on the right will be returned.
 Finally, we can say that the content of database at a point of time is called instance or
database state.
Three-Schema Architecture
 The three-schema architecture divides the database into three-level used to create a
separation between the physical database and the user application.
 In simple terms, this architecture hides the details of physical storage from the user.
 The database administrator (DBA) responsible is to change the structure of database
storage without affecting the user’s view. It deals with the data, the relationship
between them and the different access methods implemented on the database. The
logical design of database is called a schema.
 The framework of this type of architecture includes an external schema, a conceptual
level, an internal schema, and then the database itself. The various levels of the
database are mapped, which leads to the transformation of response and request in the
database.
 The three-schema architecture is as follows:

 External/ View level


o View schema is another name for the external schema.
o This is the highest level of database abstraction. It includes a number of external
schemas or user views. This level provides different views of the same database
for a specific user or a group of users. An external view provides a powerful and
flexible security mechanism by hiding the parts of the database from a particular
user.
Fig : External /View level
 Conceptual or Logical level
o The conceptual level is often known as the logical level.
o This level describes the structure of the whole database. It acts as a middle layer
between the physical storage and user view. It explains what data to be stored in
the database, what the data types are, and what relationship exists among those
data. There is only one conceptual schema per database.

Fig : Conceptual/Logical level

 Internal or Physical level


o This schema is often called as the physical schema.
o The internal level consists of an internal schema which is used to describe the
physical structure of the database in which the data is stored.
o The internal level uses the physical data model. This data model describes the
method by which the data should be stored in a block.
o Complex low-level data structures are described in detail in this schema.

Fig : Internal/Physical level


Data Independence
 Data independence can be explained using the three-schema architecture.
 Data independence refers characteristic of being able to modify the schema at
one level of the database system without altering the schema at the next higher
level.
 There are two levels of data independence based on three levels of abstraction. These
are as follows −
o Physical Data Independence
o Logical Data Independence

 1. Logical Data Independence


o Logical data independence refers characteristic of being able to change the
conceptual schema without having to change the external schema.
o Logical data independence is used to separate the external level from the
conceptual view.
o If we do any changes in the conceptual view of the data, then the user view of the
data would not be affected.
o Logical data independence occurs at the user interface level.
 2. Physical Data Independence
o Physical data independence can be defined as the capacity to change the internal
schema without having to change the conceptual schema.
o If we do any changes in the storage size of the database system server, then the
Conceptual structure of the database will not be affected.
o Physical data independence is used to separate conceptual levels from the internal
levels.
o Physical data independence occurs at the logical interface level.
Database Languages
 A DBMS has appropriate languages and interfaces to express database queries and
updates.
 Database languages can be used to read, store and update the data in the database.
 Types of Database Languages:

 1. Data Definition Language (DDL)


o DDL stands for Data Definition Language. It is used to define database structure
or pattern.
o It is used to create schema, tables, indexes, constraints, etc. in the database.
o Using the DDL statements, you can create the skeleton of the database.
o Data definition language is used to store the information of metadata like the
number of tables and schemas, their names, indexes, columns in each table,
constraints, etc.
 Here are some tasks that come under DDL:
o Create: It is used to create objects in the database.
o Alter: It is used to alter the structure of the database. (add, delete, or modify).
o Drop: It is used to delete objects from the database.
o Truncate: It is used to remove all records from a table.
o Rename: It is used to rename an object.
o Comment: It is used to comment on the data dictionary.
 Note:These commands are used to update the database schema that's why they come
under Data definition language.
 2. Data Manipulation Language (DML):
o DML stands for Data Manipulation Language. It is used for accessing and
manipulating data in a database. It handles user requests.
 Here are some tasks that come under DML:
o Select: It is used to retrieve data from a database.
o Insert: It is used to insert data into a table.
o Update: It is used to update existing data within a table.
o Delete: It is used to delete all records from a table.
o Merge: It performs UPSERT operation, i.e., insert or update operations.
o Call: It is used to call a structured query language or a Java subprogram.
o Lock Table: It controls concurrency.

 3. Data Control Language (DCL)


o DCL stands for Data Control Language. It is used to retrieve the stored or saved
data.
o The DCL execution is transactional. It also has rollback parameters.
o (But in Oracle database, the execution of data control language does not have the
feature of rolling back.)
 Here are some tasks that come under DCL:
o Grant: It is used to give user access privileges to a database.
o Revoke: It is used to take back permissions from the user.
 Note:There are the following operations which have the authorization of
Revoke:CONNECT, INSERT, USAGE, EXECUTE, DELETE, UPDATE and
SELECT.

 4. Transaction Control Language (TCL)


o TCL is used to run the changes made by the DML statement. TCL can be grouped
into a logical transaction.
 Here are some tasks that come under TCL:
o Commit: It is used to save the transaction on the database.
o Rollback: It is used to restore the database to original since the last Commit.
Interfaces
 Interface means “The way of communication performed in between a user and a
Database management system” like query passing.
 These interfaces contain some commands for creating accounts, to manipulate the
database to perform some operations on the database.
 These interfaces are specially used by the database administrators.
 The types of user friendly interfaces provided by the DBMS are shown below in the
diagram −

 This interface is further divided into four categories on the basis of technology used.
 Menu based :
o In this, all the options are displayed in form of a list or menu, through which we
can select any option and that option leads us to the destination.
o Example: When we search anything in a web browser then it shows all the
possible results in a list manner, from which we can click on any option.
o Or access any website, where all available options are arranged in menu form.

 Form based:
o In this, a form type structure is shown to the user to insert data or operate data in a
database.
o Example: online form filling for exams.
o This is also a good option to prevent redundancy because each and every user
need to go through these forms to access or manipulate databases.
o This concept makes computing very easy for those who have only basic
knowledge of computer operation.

 Graphical user interface (GUI) based:


o In this, all the available options are present as graphical symbols or buttons, like
keys on the calculator.
o All the possible queries are given in an image format to make the experience easy
and smooth. Sometimes it follows a combination of form and menu-based
interface.
o In this the overall schema is represented as a graphical image, when we click on
any specific part then the resulting query is executed.
o This makes computing very fast because the user needs to use images instead of
passing queries.
o Online games are the best example of it. The user moves in which direction the
related commands start functioning.

 Natural language based:


o In this user can pass its query just by writing them in natural language (for
computers it’s English).
o To pass on a query to the database user need to follow a structure to write a query.
o The wrong format can deny the operation.
o These schemas are consisting of commands and keywords which are predefined.
o In this user needs to understand and memories the format of queries and all the
commands.
o Sometimes the query runs on a different page and the output is displayed on a
different page. This will make computing a little cozy.
 Speech input and output:
o Limited use of speech as an input query and speech as an answer to a question or
result of a request.
o The speech input is detected using a library of predefined words and used to set up
the parameters that are supplied to the queries.
o For output, a similar conversion from text or numbers into speech takes place.
The Data Base System Environment
o A DBMS is a complex software system. In this, we discuss the types of software
components that constitute or form a DBMS and the various types of computer
software that the DBMS can communicate with.
o The following figure shows the DBMS components modules.

 The figure is divided into two parts.


o The top part of the figure refers to the various users of the database environment
and their interfaces.
o The lower part shows the internals of the DBMS responsible for storage of data
and processing of transactions.
 The database and DBMS catalog are stored on disk. Access to the disk is controlled
primarily by the operating system, which schedules disk read/write operations.
 A higher-level stored data manager module of the DBMS controls access to DBMS
information that is stored on disk, whether it is part of the database or the catalog. The
dotted lines illustrate the accesses.

Let us consider the top part of Figure:

 The DBA staff works on defining the database and tuning it by making changes to its
definition using the DDL and other privileged commands.
 DDL compiler processes schema definitions, specified in the DDL, and stores
descriptions of the schemas in the DBMS catalog.
 DBMS catalog includes information such as the names and data types of data item,
names and sizes of files, storage details of each file, mapping information among
schemas, and constraints. These are accessed by various modules of DBMS as shown
by dotted lines.
 Casual users use interactive query interface. The queries are parsed and validated for
correctness of the query syntax, the names of files and data elements, and so on by a
query compiler that compiles them into an internal form.This internal form is
subjected to query optimization.
 The query optimizer is concerned with the rearrangement and possible reordering of
operations, elimination of redundancies, and use of correct algorithms and indexes
during execution.It consults the system catalog for statistical and other physical
information about the stored data and generates executable code that performs
necessary operations for the query and makes calls to the runtime processor.
 Application programmers write programs in host language (C, C++, Java) and
submitted to a pre-compiler.
 The pre-compiler extracts DML commands from an application program, and these
commands are sent to DML compiler for compilation into object code for database
access.
 The rest of the program is sent to the host language compiler.The object codes for
the DML commands and the rest of the program are linked, forming a canned
transaction whose executable code includes calls to the runtime database processor.
 Parametric users Canned transactions are executed repeatedly, whosimply supply
the parameters to the transactions. Each execution is considered to bea separate
transaction. An example is a bank withdrawal transaction where theaccount number
and the amount may be supplied as parameters.

Let us consider the lower part of Figure:

 The runtime database processor executes (1) the privileged commands, (2) the
executable query plans, and (3) the canned transactions with runtime parameters. It
works with the system catalog and may update it with statistics.
 The runtime database processor handles other aspects of data transfer, such as
management of buffers in the main memory. Some DBMSs have their own buffer
management module while others depend on the OS for buffer management.
 The stored data manager, which in turn uses basic operating system services for
carrying out low-level input/output (read/write) operations between the disk and main
memory.
 Concurrency control and backup and recovery systems modules are integrated
into the working of the runtime database processor for the purposes of transaction
management.
Centralized and Client/Server Architectures
for DBMSs
 In Centralized Architecture, the mainframe computers are used for processing
all system functions including User application Programs and User Interface
Programs as well as DBMS functionalities.
 This is because in earlier days, most users accessed such systems via Computer
Terminals, which can’t Process, and they have only display capability. Therefore, the
Processing used to takeplace in these Computer Systems and the display information
is sent to display terminals and these terminals are connected to mainframe computers
via various kinds of Networks.
 As the days pass by, we are now having Personal Computers (PC’s) in the market.
But still in the beginning Centralized Architecture for DBMS was used. Gradually the
DBMS systems started to make use of Processing Power in the used side i.e
Computers have come with Processing Power and in turn led to the use of
Client/Server Architecture.

Fig 1: Centralized Architecture for DBMS


 Client/Server Architecture:
 The concept of client/server architecture assumes an underlying framework that
consists of many PCs as well as a smaller number of mainframe machines, connected
via LANs and other types of computer networks.A client in
this framework is typically a user machine that provides user interface capabilities and
local processing. When a client requires access to additional functionality, such as
database access which does not exist at that machine, it connects to a server that
provides the needed functionality.
 A Server is a system which contains both Hardware and Software which provides
services to client Machines like file access, printing and database access.

 1)Two Tier Client/Server Architecture for DBMS:


 Here, the term "two-tier" refers to our architecture's two layers-the Client layer
and the Data layer. There are several client computers in the client layer that can
contact the database server. The API on the client computer will use JDBC or
some other method to link the computer to the database server. This is due to the
possibility of various physical locations for clients and database servers.
 For example, if we query the database to retrieve some information, the query will be
Processed by Database server and that information will be sent to the client by
Database server itself!!!

Fig2 : Two-Tier Architecture for DBMS


 2) Three-Tier client/server Architecture for DBMS:
 Here there is an additional layer which acts as an intermediate between Client
layer and Datalayer called Business logic layer. Business logic layer is the layer
where the Application Programs are processed. Here the Application Programs
are processed in the Application server itself, which makes it different from
Two-tier Architecture where queries are processed in the database server.
 Simply the Client machines will contact Application Server which in turn processes
our Application Programs and fetches the Required Data from Database and then
sends this Information back to the client machine in the suitable format only.

Fig 3:Three-Tier client/server Architecture for DBMS

-------------------------------------------------------------------------------------------------------

You might also like