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

Unit1 Chap2 Notes Dbms

Bca 2nd sem

Uploaded by

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

Unit1 Chap2 Notes Dbms

Bca 2nd sem

Uploaded by

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

JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT

#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082


E-mail: [email protected] Website: www.jyothyicm.org

DATABASE SYSTEM
CONCEPTS AND
ARCHITECTURE
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

Data Model:

Data model can be defined as an integrated collection of concepts for describing and
manipulating data, relationships between data, and constraints on the data in an organization.

A data model comprises of three components:

 Structural part: consisting of a set of rules according to which databases can be


constructed.

 Manipulative part: defining the types of operation that are allowed on the data (This
includes the operations that are used for updating or retrieving data from the db and for
changing the structure of the db)

 Set of Integrity Rules: This ensures that the data is accurate.

Categories of Data Models:

It is basically classified into 3 types:-

1. Conceptual/High level Data


Model

2. Representational/Implementation
/logical Data Model

3. Physical/Low level Data Model

1. Conceptual Data Model


It is a high-level diagram that we use to define, describe, organize, and present data
elements and their relationships with relatively few details. Conceptual data models
contain only:
1. The real-world entities that are our main data elements.
2. Their relationships.

The 3 basic tenants of Conceptual Data Model


are

• Entity: A real-world thing

• Attribute: Characteristics or properties of an entity

Page 1
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

• Relationship: Dependency or association between two entities

2. Logical/Representational/Implementation Data Model


The Logical Data Model is used to define the
structure of data elements and to set relationships
between them. The logical data model adds further
information to the conceptual data model elements.
A popular logical model is a Relational model.

3. Physical Data Model


The physical data model includes all database-
specific features, such as data types, database indices,
triggers, constraints, and more. It includes primary
and foreign keys, column and value constraints, and
other database-specific features.

Different types of Data Models

Hierarchical Model:
This is one of the oldest models in a data model which was developed by IBM, in the 1950s. In
this, the data is organized into a tree-like structure where each record consists of one parent
record and many children. The hierarchy begins at the root, which contains root data, and then
grows into a tree as child nodes are added to the
parent node.

Example

The adjacent diagram depicts the relationship


between the shoes available on a shopping website.

Features of a Hierarchical Model

1. Parent-Child Relationship- A parent node exists for each child node. However, a parent node
might have several child nodes. It is not permitted to have more than one parent.

Page 2
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

2. One-to-many Relationship- The data is organised in a tree-like form, with the datatypes
having a one-to-many relationship. There can only be one path from any node to its parent.

Advantages:

1. Simplicity

2. Security

3. Database Integrity

4. Efficiency

Disadvantages:

1. Implementation Complexity

2. Db management problem: any changes made to the db structure, then we need to make
changes in the entire application program that access the database.

3. Lack of structural independence: When we change the structure then it becomes


compulsory to change the application too.

4. Operational Anomalies: This model suffers from the insert, delete and update anomalies
and also retrieval operation is difficult.

Network Data Model:

The hierarchical model is extended in the network model. To increase database performance
and standards, the network model was devised to express complicated data relationships more
effectively than hierarchical models. It has entities that are grouped in a graphical format, and
some of the entities can be reached by many paths.

Example

In the adjacent diagram, we can observe that the


node student has two parents, CSE Department and
Library, in the example below. In the hierarchical
model, this was previously impossible.

Page 3
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

Features of a Network Model

1. Multiple Paths

There may be several paths to the same record due to the increased number of relationships. It
allows for quick and easy data access.

2. The Ability to Merge More Relationships

Data is more connected in this model since there are more relationships. This paradigm can
handle many-to-many as well as one-to-one relationships.

ADVANTAGES

The major advantage of network model are-

1. Simple and easy to design.


2. Can handle one to many and many to many relationships.
3. The data access is easier and flexible than the hierarchical model.
4. Data integrity is maintained.
5. Data Independency

DISADVANTAGES

1. System complexity
2. Operational Anomalies
3. Structural changes to the database are very difficult.

Relational Data Model:

The relational model represents how data is stored in Relational Databases. A relational
database consists of a collection of tables, each of which
is assigned a unique name. In relational model, three key
terms are heavily used such as relations, attributes, and
domains. A relation nothing but is a table with rows and
columns. The named columns of the relation are called as
attributes, and finally the domain is nothing but the set
of values the attributes can take. The adjacent figure
gives us the overview of relational database model.

Page 4
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

Characteristics of the Relational Model

 Data is represented in rows and columns called relations.


 Data is stored in tables having relationships between them called the Relational
model.
 The relational model supports the operations like Data definition, Data manipulation,
and Transaction management.
 Each column has a distinct name and they are representing attributes.
 Each row represents a single entity.

Advantages

 Simple and easy to use


 More flexible
 More secure
 Data is more accurate
 The integrity of the data is maintained
 Operations can be performed easily

Disadvantages

 Not very good for large databases


 Sometimes, it becomes difficult to find the relation between tables.
 Because of the complex structure, the response time for queries is high.

Object-Oriented Data Model

In this model both data and the data relationships are stored into a single structure that’s known
as an object in the object-oriented data model (or OODM).

Here is an example of this model:

Multiple objects are connected in this model using


connections. The following example can help you understand
this. The Employee and Department are the two objects in the example.

Advantages

 Codes can be reused due to inheritance.

Page 5
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

 Easily understandable.
 Cost of maintenance can reduced due to reusability

Disadvantages

 It is not properly developed so not accepted by users easily.

Schemas and Instances:

Schema:

The overall design of the database is called database schema. Schema will not be changed
frequently. It is the logical structure of a database. It
does not show the data in the database.

The schema is pictorially represented as shown in the


adjacent figure.

Types of Schema

The different types of schemas are as follows −

 Physical schema − It is a database design at the physical level. It is hidden below the
logical schema and can be changed easily without affecting the application programs.

 Logical schema − It is a database design at the logical level. Programmers construct


applications using logical schema.

 External − It is schema at view level. It is the highest level of a schema which defines
the views for end users.

Generally the Database Management System (DBMS) assists one physical schema, one logical
schema and several sub or external schemas.

Example

A database schema for a person will have fields for name, email, phone and address as shown
below –

Page 6
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

Instance

The Database instance or database state refers to the information stored in the database at a
given point of time. Thus, it is a dynamic value which keeps on changing.

Example

A database instance for the Person


database can be
(User1,emai.com,11345679,addr) So the
person construct will contain their
individual entities in the attributes called as
instance. This is shown in the adjacent
figure.

Difference between Schema and Instance

Schema Instance

It is the collection of information stored


It is the overall description of the database.
in a database at a particular moment.

Data in instances can be changed using


The schema is same for the whole database.
addition, deletion, and updation.

Does not change Frequently. Changes Frequently.

Defines the basic structure of the database i.e. It is the set of Information stored at a
how the data will be stored in the database. particular time.

Conclusion

In short, the schema is the blueprint of the database, while the instance is the actual data
that is in the database. The schema is the database’s design, and the instance is the data it
contains.

Page 7
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

When you change the schema, you change the structure of the database. When you change the
instance, you change the data content.

Three schema Architecture

The Three-Schema Architecture

 Physical Level: This is the lowest level of database abstraction. In simple terms,
physical level of a database describes how the data is being stored in secondary storage
devices like disks and tapes and also gives insights on additional storage details. The
physical schema is also known as a Internal schema.

 Conceptual Level: 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. The conceptual schema
describes the design of a database at the conceptual level. Conceptual level is also known
as logical schema.
 External Level: 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. An
external schema is also known as view schema.

Page 8
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

Mapping:

The three levels of DBMS architecture don't exist independently of each other. There must
be correspondence between the three levels. DBMS is responsible for correspondence
between the three types of schema. This correspondence is called Mapping.

There are basically two types of mapping in the database architecture:

 Conceptual/ Internal Mapping


 External / Conceptual Mapping

Conceptual/ Internal Mapping

The Conceptual/ Internal Mapping lies between the conceptual level and the internal level.
Its role is to define the correspondence between the records and fields of the conceptual
level and files and data structures of the internal level.

In simple words, the method of transforming a request from conceptual level and internal
level is called conceptual/Internal mapping.

External/ Conceptual Mapping

The external/Conceptual Mapping lies between the external level and the Conceptual level.
Its role is to define the correspondence between a particular external and the conceptual
view.

In simple words, when a request is sent by the external user, the method of transforming the
request from external level to conceptual level is called External/Conceptual Mapping.

Data Independence

Data Independence is mainly defined as a property of DBMS that helps you to change the
database schema at one level of a system without changing the schema at the next level.

The two levels of data independence are:

 Physical level data independence

 Logical level data independence

Page 9
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

Physical Level Data Independence

It refers to the characteristic of being able to


modify the physical schema without any
alterations to the conceptual or logical schema

Logical Level Data Independence

It refers characteristic of being able to modify


the logical schema without affecting the
external schema or application program. The
user view of the data would not be affected by any changes to the conceptual view of the data.

Database Languages in DBMS

o 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:

 Create: It is used to create objects in the database.


 Alter: It is used to alter the structure of the database.
 Drop: It is used to delete objects from the database.
 Truncate: It is used to remove all records from a table.
 Rename: It is used to rename an object.
 Comment: It is used to comment on the data dictionary.
Page 10
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

2. Data Manipulation Language (DML)

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:

 Select: It is used to retrieve data from a database.


 Insert: It is used to insert data into a table.
 Update: It is used to update existing data within a table.
 Delete: It is used to delete all records from a table.
 Merge: It performs UPSERT operation, i.e., insert or update operations.
 Call: It is used to call a structured query language or a Java subprogram.
 Explain Plan: It has the parameter of explaining data.
 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.

Here are some tasks that come under DCL:

 Grant: It is used to give user access privileges to a database.


 Revoke: It is used to take back permissions from the user.

4. Transaction Control Language (TCL)

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:

 Commit: It is used to save the transaction on the database.


 Rollback: It is used to restore the database to original since the last Commit.

DBMS Interfaces:

Interfaces are the programs which convert system language to user understandable language
and user language to system understandable language.

Page 11
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

User-friendly interfaces provided by a DBMS


may include the following:

Menu Based Interfaces for Web Clients or


Browsing. These interfaces present the user with
lists of options, called menus that lead the user
through the formulation of a request. Pull-down
menus are a very popular technique in Web-based
user interfaces.

Forms Based Interfaces. A forms-based interface


displays a form to each user. Users can fill out all of the form entries to insert new data, or they
fill out only certain entries, in which case the DBMS will retrieve matching data for the
remaining entries. Forms are usually designed and programmed for naive users as interfaces to
canned transactions.

Graphical User Interfaces. A graphical interface (GUI) typically displays a schema to the user
in diagrammatic form. The user can then specify a query by manipulating the diagram. In many
cases, GUIs utilize both menus and forms. Most GUIs use a pointing device, such as a mouse,
to pick certain parts of the displayed schema diagram.

Natural Language Interfaces. These interfaces accept requests written in English or some
other language and attempt to "understand" them. A natural language interface usually has its
own "schema," which is similar to the database conceptual schema, as well as a dictionary of
important words. The natural language interface refers to the words in its schema, as well as to
the set of standard words in its dictionary, to interpret the request.

Interfaces for Parametric Users. Parametric users, such as bank tellers, often have a small set
of operations that they must perform repeatedly. Systems analysts and programmers design
implement a special interface for naive users. Usually, a small set of abbreviated commands is
included, with the goal of minimizing the number of keystrokes required for each request.

Interfaces for the DBA. Most database systems contain privileged commands that can be used
only by the DBA's staff. These include commands for creating accounts, setting system
parameters, granting account authorization, changing a schema, and reorganizing the storage
structures of a database.

Page 12
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

The Database System Environment

A DBMS is a complex software system. The database and the DBMS catalog are usually stored
on disk. Access to the disk is controlled primarily by the operating system (OS), which
schedules disk read/write.

Many DBMSs have their own buffer management module to schedule disk read/write,
because this has a considerable effect on performance. Reducing disk read/write improves
performance considerably. 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 top part of Figure, It shows interfaces for the DBA staff, casual users who work with
interactive interfaces to formulate queries, application programmers who create programs using
some host programming languages, and parametric users who do data entry work by supplying
parameters to predefined transactions. The DBA staffs works on defining the database and
tuning it by making changes to its definition using the DDL and other privileged commands.

The DDL compiler processes schema definitions, specified in the DDL, and stores descriptions
of the schemas (meta-data) in the DBMS catalog. The catalog includes information such as the
names and sizes of files, names and data types of data items, storage details of each file,
mapping information among schemas, and constraints.

Casual users and persons with occasional need for information from the database interact using
some form of interface, which we call the interactive query interface. These queries are parsed
and validated for correctness of the query syntax, the names of files and a query compiler that
compiles them into an internal form. This internal query 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.

The precompiler extracts DML commands from an application program written in a host
programming language. 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.
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.

It is now common to have the client program that accesses the DBMS running on a separate
computer from the computer on which the database resides. The former is called the client

Page 13
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

computer running DBMS client software and the latter is called the database server. In some
cases, the client accesses a middle computer, called the application server, which in turn
accesses the database server.

DATABASE SYSTEM ENVIRONMENT

Centralized and Client/Server Architectures for DBMSs

Centralized DBMSs Architecture

Architectures for DBMSs have followed trends similar to those for general computer system
architectures. Earlier architectures used mainframe computers to provide the main processing
for all system functions, including user application programs and user interface programs, as
well as all the DBMS functionality. The reason was that most users accessed such systems via
computer terminals that did not have processing power and only provided display capabilities.
Therefore, all processing was performed remotely on the computer system, and only display
information and controls were sent from the computer to the display terminals, which were
connected to the central computer via various types of communications networks.

Page 14
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

At first, database systems used these


computers similarly to how they had
used display terminals, so that the
DBMS itself was still a centralized
DBMS in which all the DBMS
functionality, application program
execution, and user interface
processing were carried out on one
machine. The Figure illustrates the
physical components in a centralized
architecture. Gradually, DBMS
systems started to exploit the
available processing power at the user side, which led to client/server DBMS architectures.

Client/Server Architectures for DBMSs

Database architecture essentially describes the location of all the pieces of information that
make up the database application. Database architecture is logically divided into two types.

a) Logical two-tier Client / Server architecture

b) Logical three-tier Client / Server architecture

Two-tier Client / Server Architecture

o The 2-Tier architecture is same as basic


client-server. In the two-tier architecture,
applications on the client end can directly
communicate with the database at the server
side. For this interaction, API's
like: ODBC, JDBC are used.

o The user interfaces and application programs


are run on the client-side.

o The server side is responsible to provide the


functionalities like: query processing and
transaction management.

Page 15
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

o To communicate with the DBMS, client-side application establishes a connection with


the server side.

Three-tier Client / Server Architecture

Three-tier Client / Server database architecture is commonly used architecture for web
applications.

Three-Tier Architecture is a well-established software application design pattern which will


organizes the application in the three logical and physical computing tiers as following:

 Presentation Tier

 Application Tier

 Data Tier

Presentation Tier

It is the user interface and topmost tier in the


architecture. Its purpose is to take request from the
client and displays information to the client. It
communicates with other tiers using a web browser
as it gives output on the browser. If we talk about
Web-based tiers then these are developed using
languages like- HTML, CSS, JavaScript.

Application Tier

It is the middle tier of the architecture also known as the logic tier as the information/request
gathered through the presentation tier is processed in detail here. It also interacts with the server
that stores the data. It processes the client’s request, formats, it and sends it back to the client. It
is also called as the intermediate layer.

Data Tier

It is the last tier of the architecture also known as the Database Tier. It is used to store the
processed information so that it can be retrieved later on when required. It consists of Database
Servers like Oracle, MySQL, DB2, etc. The communication between the Presentation Tier and
Data-Tier is done using middle-tier i.e. Application Tier.

Page 16
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

1. Centralized Database:

A centralized database is basically a type of


database that is stored, located as well as
maintained at a single location only. This
type of database is modified and managed
from that location itself. The centralized
location is accessed via an internet
connection (LAN, WAN, etc). This
centralized database is mainly used by
institutions or organizations.

Advantages:

 Minimal data redundancy.

 Accessing and coordinating with data is easy.

 Cheaper when compared to all other databases available.

Disadvantages:

 Data traffic is more.

 Any kind of system failure will result in loss of entire data.

2. Distributed Database:

A distributed database consists of multiple


databases that are connected with each other and
are spread across different physical locations.
The data is stored in various physical locations
and can be managed independently of other
physical locations. The communication between
databases which are at different physical
locations is done by a computer network.

Advantages:

Page 17
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

 Database can be easily expanded.

 Can be easily accessed through different networks.

 More secured database.

Disadvantages:

 Cost is high and difficult to maintain due to its complexity.

 Difficult to provide a uniform view to users since the database is at different physical
locations.

Difference between Centralized database and Distributed database:

Centralized Database Distributed Database

Database is maintained at one site Database is maintained at multiple sites that


are connected with each other through
network.

If the centralized system fails, entire system If one system fails, continues with the other
is halted. sites.

Less reliable More reliable

Access time is more in case of multiple Access time is less even in the case of
users. multiple users.

Cost is less Very expensive

Less efficient More efficient

Classification of DBMS:

The DBMS can be classified into different categories on the basis of several criteria such as:

Page 18
JYOTHY INSTITUTE OF COMMERCE & MANAGEMENT
#40/5, THATHAGUNI, OFF KANAKAPURA ROAD, BENGALURU – 560082
E-mail: [email protected] Website: www.jyothyicm.org

1. Classification based on Data Model

 Relational data model


 Hierarchical data model
 Network data model
 Object-oriented data model
 Object-relational data model

2. Classification based on Number of Users

 Single user systems-database resides on one computer and is only


accessed by one user at a time.
 Multi user systems-multiple users can access the database
simultaneously.

3. Classification based on number of sites

 Centralized-data is stored at single site.


 Distributed-database stored over many sites connected by network.
 Homogeneous-use same DBMS software at multiple sites.
 Online Transaction Processing-used for data entry and retrieval.

4. Classification based on cost

 Low-end systems
 High-end systems.

5. Classification based on purpose

 General purpose
 Specific purpose

*******************************************

Page 19

You might also like