DBMS Unit - 1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 23

Different types of Database Users

Database users are categorized based up on their interaction with the


database. These are seven types of database users in DBMS.

1. Database Administrator (DBA) : Database Administrator


(DBA) is a person/team who defines the schema and also
controls the 3 levels of database. The DBA will then create a
new account id and password for the user if he/she need to
access the database.
DBA is also responsible for providing security to the
database and he allows only the authorized users to
access/modify the data base.
DBA is responsible for the problems such as security
breaches and poor system response time.
 DBA also monitors the recovery and backup and
provide technical support.
 The DBA has a DBA account in the DBMS which
called a system or superuser account.
 DBA repairs damage caused due to hardware and/or
software failures.
 DBA is the one having privileges to perform DCL
(Data Control Language) operations such as GRANT
and REVOKE, to allow/restrict a particular user from
accessing the database.

Schema :
Schema is the overall description of the database. The basic
structure of how the data will be stored in the database is
called schema.
Schema is of three types: Logical Schema, Physical Schema
and view Schema.
1. Logical Schema – It describes the database designed
at logical level.
2. Physical Schema – It describes the database
designed at physical level.
3. View Schema – It defines the design of the database
at the view level.

Example –
Let’s say a table teacher in our database name school, the
teacher table require the name, dob, doj in their table so we
design a structure as :
Teacher table
name: String
doj: date
dob: date

2. Naive / Parametric End Users : Parametric End Users are


the unsophisticated who don’t have any DBMS knowledge
but they frequently use the database applications in their daily
life to get the desired results. For examples, Railway’s ticket
booking users are naive users. Clerks in any bank is a naive
user because they don’t have any DBMS knowledge but they
still use the database and perform their given task.

3. System Analyst :
System Analyst is a user who analyses the requirements of
parametric end users. They check whether all the
requirements of end users are satisfied.

4. Sophisticated Users : Sophisticated users can be engineers,


scientists, business analyst, who are familiar with the
database. They can develop their own database applications
according to their requirement. They don’t write the program
code but they interact the database by writing SQL queries
directly through the query processor.

5. Database Designers : Data Base Designers are the users who


design the structure of database which includes tables,
indexes, views, triggers, stored procedures and constraints
which are usually enforced before the database is created or
populated with data. He/she controls what data must be stored
and how the data items to be related. It is responsibility of
Database Designers to understand the requirements of
different user groups and then create a design which satisfies
the need of all the user groups.

6. Application Programmers : Application Programmers also


referred as System Analysts or simply Software Engineers,
are the back-end programmers who writes the code for the
application programs. They are the computer professionals.
These programs could be written in Programming languages
such as Visual Basic, Developer, C, FORTRAN, COBOL etc.
Application programmers design, debug, test, and maintain
set of programs called “canned transactions” for the Naive
(parametric) users in order to interact with database.

7. Casual Users / Temporary Users : Casual Users are the


users who occasionally use/access the database but each time
when they access the database they require the new
information, for example, Middle or higher level manager.
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.
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.

These commands are used to update the database schema


that's why they come under Data definition language.

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:

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 Explain Plan: It has the parameter of explaining data.
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.

(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.

There are the following operations which have the authorization


of Revoke:

CONNECT, INSERT, USAGE, EXECUTE, DELETE, UPDATE and


SELECT.

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:


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.
What are the characteristics of DBMS software?

1. Real-world entity

Data management systems have been designed keeping in


mind the needs of business organizations. They help
businesses manage large amounts of data efficiently. These
systems store huge volumes of data and provide easy ways to
search through them. Some examples of such applications are
Microsoft Access, Oracle, MySQL, etc.

2. Relational databases

Relational databases were first introduced in the 1970s. In this


type of database, each record contains fields called attributes.
Each attribute represents one piece of information about a
particular object.

For example:

If you want to keep track of your personal details then you will
need three different attributes namely name, address, phone
number. All of these attributes together form a single row in a
table. This means that every time we add new information into
our database, we must insert multiple rows into the same
table.

If we do not follow this rule then we may end up having


duplicate entries in our database. So relational databases
allow us to organize data using relations between objects.

3. Structured query language

Structured Query Language was developed in the 1980s. It


provides a way to write queries against a database. Queries
written in SQL are known as structured queries because they
use predefined structures to define relationships among
entities.

An example would be:

SELECT * FROM employees WHERE department 'IT'. Here,


the word ‘*’ stands for all columns from the employee table.
We can also specify only certain columns while selecting other
ones.

Another important feature of SQL is its ability to combine two


statements into one statement.

4. Isolation of data and application

A database system is not the same thing as its data. A


database works and organizes, whereas data is said to be
passive. Metadata, which is data about data, is stored by the
database management system.

Also, in a traditional file management system, the structure of


data files is defined in the application programs so the user
had to change everything. But in DBMS, the structure of data
files is not stored in the program but it is stored in the system
catalogue. Internal improvement of data efficiency or any
changes in the data doesn't have an effect on application
software with the help of this- that is, it offers insulation
between Data and Program.

5. ACID properties

DBMS adheres to the concepts


of Atomicity, Consistency, Isolation, and Durability, or ACID
Properties. These concepts are applied to transactions, which
operate and play around with data in a database. In multi-
transactional environments, ACID properties help the database
stay healthy in case of failure.

Any changes that occur in any particular


transaction will not be seen by other transactions
until the change is not committed in the memory.

Example: If two operations are concurrently


running on two different accounts, then the value
of both accounts should not get affected. The
value should remain persistent.

6. Multiuser and concurrent access

Data can be accessed and manipulated in parallel with the


help of the DBMS. Users are unaware of the restrictions on
transactions when handling the same data item.

DBMS offers multiple views for various clients. A client who is


in the Sales division will have an alternate perspective on the
database than an individual working in the Production office.
This component empowers the clients to have a concentrated
perspective on the database as indicated by their
prerequisites.

7. Object oriented programming

Object oriented programming is another technique used to


design programs. Objects contain properties and methods.
Properties represent variables or constants which hold values.
Methods are procedures that operate on those properties. The
main advantage of OOP over procedural programming is that it
allows developers to create reusable components by
encapsulating their functionality within classes. Classes are
collections of related code and data elements. Developers can
reuse existing classes instead of writing similar pieces of code
again and again.

8. Transactional processing

Transactions are an essential part of any application.


Transactions ensure consistency across multiple users
accessing the system at the same time. When transactions fail
due to errors, the entire transaction should roll back so that no
changes made during the failed operation remain permanent.
Transaction processing ensures that when there is a problem,
everything remains consistent.

9. Data mining

Data mining refers to techniques used to analyse vast


quantities of unstructured data. There are many types of data
mining algorithms like classification, clustering, association
rules, regression analysis, decision trees, neural networks,
genetic algorithms, etc.

 Classification involves grouping records based on some


common characteristics.
 Clustering groups records with similar features under one
category.
 Association rules look for patterns in sets of items and
suggest possible combinations of items that occur
frequently together.
 Decision tree classifies records according to various
factors.
 The neural network uses artificial intelligence to learn how
to classify records.
 The genetic algorithm helps find optimal solutions to
problems.
10. Distributed database systems

Distributed databases store information across several


computers connected through a computer network. This type of
architecture makes it easy to add more servers without having
to rebuild the whole software infrastructure. A distributed
database has three parts: client applications, server
applications, and shared storage. Client applications access
the shared storage using standard protocols such as TCP/IP.
Server applications provide services to clients. Shared storage
provides persistent storage space where all the data resides.
In addition, each node stores metadata about other nodes in
the cluster.

11. Less redundancy and consistency

The DBMS follows the rules of normalization, which splits a


relation when there is more than one attribute with the same
value. Normalization is a method of reducing data redundancy.
Every relation in a database is consistent, that's the state of
consistency. Attempts to leave databases in different states
can be detected with methods and techniques. A database
management system can give greater consistency than earlier
forms of data storage.

12. Data security and integrity

DBMS gives security to the information put away in this is on


the grounds that all clients have different rights to access the
database. A portion of the client can get to the entire
information in the database while others can get to a small
segment of the database.

For instance, a fluid mechanics instructor can only access


those documents that are identified with his subject, however,
the HOD of the division can get to records of all subjects that
are identified with their department.

One of the main attributes of a database management system


(DBMS)-integrity guarantees the quality and dependability of
the database framework. It protects from unapproved access to
the database and makes it safer. It allows only consistent and
exact information into the database.

Data Abstraction in DBMS


Overview

Data abstraction is the method of hiding the unimportant details that are present in the
database from the end users to make the accessing of data easy and secure.

Scope

In this article on Data Abstraction, we will look at the following points:

 What data abstraction is and how it is related to our daily lives.


 The different layers of data abstraction in DBMS.
Introduction

Data abstraction is present in our daily lives. Let us take a small example. Say, someone,
asks you to switch on the fans in a room. All you will need to do is simply walk to the
switchboard and turn on the switch for the fan, that’s it! Do you need to know where the
electricity is coming from, how the poles of the switch are connected, or exactly what the
internal working of a fan is? The answer to all this is NO! That is what data abstraction is,
all these background details are hidden from you inside the switchboard!
All the databases have complex data structures which are, in fact, of no use to an end user.
Thus, these internal irrelevant details are hidden from the user, making the accessing of
data simple and increasing the security of the data as well. This is what Data Abstraction
is.

Levels of Data Abstraction in DBMS

The data
abstraction
in DBMS is
implemented
in 3 layers:

 Physical
or
Internal
Level
 Logical
or

Conceptual Level
 View or External Level

The following diagram will give you a clear view of how the implementation is done.
Starting from the very bottom, we have the physical or internal layer, then we have
the middle layer, the logical or conceptual layer, and finally, we have the view or external
layer.

Let us discuss each of these three layers in detail.

Physical Level or Internal Level

This is the layer of data abstraction where the raw data is physically stored as files. This
layer contains all the complex data structures and the data accessing methods defined.
The physical layer is the lowest level of data abstraction in a DBMS. It is the database
administrator who decides how the data is to be stored in these physical hard drives.

Example:

When we access data we may get a single data or a table of data. Moreover, by the term
"relational database" we visualize a table of rows and columns. But at a physical level,
these tables are stored in hard drives which are located at a very secure data centre.

Logical Level or Conceptual Level

After taking the raw data from the physical or internal level, the structure of the data is
defined at the logical or conceptual level. This is like a blueprint of the raw data. This layer
does not have any information about how the end user will view the data.

Example:

We have data of a few products like product id, product name, and manufacturing date,
and we have another set of data of customers containing customer id, customer name,
and customer address. Now, we need to frame this data in proper tables of products and
customers. After that, we can even frame a join to show which product has been ordered
by which customer.

View Level or External Level

This is what an end-user gets to see. He/she does not get the entire database, but
depending on the queries made from the front-end the user gets to see the data. It may be
a single data from the entire database or a collection of data in tabular format. Multiple
views of the same data are available to the user, the representation can be a table, a
graph, or a pie chart. View Level is the highest level of data abstraction in DBMS.
Example:

Concerning the example in the logical level section, let us say a customer wants to view
the order history, he gets to see only the orders he had made in the past. Now, let us say a
shop owner needs to see the products that are on the order list. He gets to see a table
containing all the info about the products and the customers to whom they need to be
delivered.

Conclusion

 Data abstraction in DBMS means hiding unnecessary background details from the end user
to make the accessing of data easy and secure.
 In DBMS, there are 3 levels of data abstraction:
o Physical Level or Internal Level: This is the layer where the raw data is stored in
file format on physical hard drives.
o Logical Level or Conceptual Level: In this layer, the raw data is taken from the
physical layer and organized in a proper structure, like in tabular format.
o View Level or External Level: At this level, the end users get the data depending
on the queries. The same data can be viewed in multiple ways, like tables, graphs,
or pie charts.

Physical and Logical Data


Independence
1. Physical Data Independence :
Physical Data Independence is defined as the ability to make changes in the structure
of the lowest level of the Database Management System (DBMS) without affecting
the higher-level schemas. Hence, modification in the Physical level should not result
in any changes in the Logical or View levels.
Note –
There are 3 levels in the schema architecture of DBMS: Physical level, Logical level,
and View level (arranged from the lowest to highest level).
Example –
Changes in the lowest level (physical level) are: creating a new file, storing the new
files in the system, creating a new index, etc.
Instances of why we may want to do any sort of Data modification at the physical
level- We may want to alter or change the data at the physical level. This is because
we may want to add or remove files and indexes to enhance the performance of the
database system and make it faster. Hence, in this way, Physical Data Independence
enables us to do Performance Tuning. Ideally, when we change the physical level, we
would not want to alter the logical and view level.
Logical Data Independence
Logical Data Independence is defined as the ability to make changes in the structure
of the middle level of the Database Management System (DBMS) without affecting
the highest-level schema or application programs. Hence, modification in the logical
level should not result in any changes in the view levels or application programs.
Example –
Changes in the middle level (logical level) are: adding new attributes to a relation,
deleting existing attributes of the relation, etc. Ideally, we would not want to change
any application or programs that do not require to use of the modified attribute.
Difference between Physical and
Logical Data Independence
 To break an existing record i.e to divide the record into two or more
records

Difference between Physical and Logical Data Independence :


Physical Data Independence Logical Data Independence

It mainly concern about how the data is It mainly concerned about the structure
stored into the system. or the changing data definition.

It is difficult to retrieve because the data


is mainly dependent on the logical
It is easy to retrieve. structure of data.

As compared to the logical As compared to the physical


independence it is easy to achieve independence it is not easy to achieve
physical data independence. logical data independence.

Any change at the physical level, does


not require to change at the application The change in the logical level requires a
level. change at the application level.

The modifications made at the internal The modifications made at the logical
level may or may not be needed to level is significant whenever the logical
improve the performance of the structure of the database is to be
structure. changed.

It is concerned with the conceptual


It is concerned with the internal schema. schema.

Example: Change in compression Example: Add/Modify or Delete a new


techniques, Hashing algorithms and attribute.
Physical Data Independence Logical Data Independence

storage devices etc.

Data Models in DBMS

Introduction to Types of Data Model


For the creation of any database, the data model is considered a logical structure for creating

a database. The data model includes entities, attributes, constraints, relationships, etc. The

data models are used to represent the data and how it is stored in the database, how data is

accessible and updated in the database management system. There are four types of data

models: Hierarchical model, Network model, Entity-relationship model, Relational model.

These models have further categories which are used according to a different use case.

Different Types of Data Models


There are 4 different types of data models:

1. Hierarchical Model
In this type of data model, the data is organized into a tree-like structure that has a

single root and the data is linked to the root. In this model, the main hierarchy

begins from the root and it expands like a tree that has child nodes and further

expands in the same manner. In this model the child node has one single parent

node but one parent can have multiple child nodes. As the data is stored like tree
structure in this data model when data is retrieved the whole tree is traversed from

the root node. The hierarchical data model contains a one-to-many relationship

between various types of data. The data is stored in the form of a record and is

connected through links.

For Example- there is an organization that has a requirement to store the

information of its employees. The table contains the following attributes: employee

name, employee code, department name, and last name. And the organization

provides a computer for each employee. So there is a requirement for storing

information on a computer which is stored in a separate table. The computer table

store employee code, serial number, and type. According to the hierarchical data

model, the employee table can be considered as a parent table and a computer table

can be considered as a child node.

2. Network model
The network model is a type of database model which is designed based on a

flexible approach for representing objects and the relationship exist among objects.

The schema is very important in the network data model which can be represented

in the form of a graph where a relationship is represented using edges and the

nodes are used to represent objects. The basic difference between the hierarchical

model and network model is that data is represented in the form of hierarchy in a

hierarchical data model whereas in network model the data is represented in the

form of a graph. One of the advantages of a network model is that the basic

connections are also represented in this data model. There are different types of
relationship can exist in this data model like one to one, many to many, etc. The

data access becomes simple to compare to other data model like the hierarchical

model. The parent node and child node are always connected as there is always a

relationship exist among parent-child node. And the data is not dependent on the

other node. One of the key drawbacks of this model is that this system is not

adaptive toward changes. It means when there is a requirement of some

modification of system it requires to change the whole system which takes a lot of

effort. And to maintain data is difficult to part in this model as every record is

connected via some pointers which makes it difficult to maintain and make the

system complex.

3. E-R model
The ER model is used to describe the database structure using the entity-

relationship diagram. The E-R model is just like the blueprint of a database which

is used to implement the database. In the entity set, the relationship exists which

can be shown using the ER diagram. The entity set consists of a similar type of

entities that consist of attributes.

The components of the ER model are relationship set and entity set and attributes.

The entity is the component of data which is represented as a rectangle in the ER

diagram. For example, there are two entities college and student and there exist one

too many relationships as there can be more than one student who can go to

college.
The entity which cannot be identified by attributes and which require a relationship

is called a weak entity. For representing a weak entity the entity is represented in a

double rectangle. For example, there is a bank account but it cannot relate until the

bank name is not known to the bank account is termed as a weak entity.

The attributes are used to represent the property of the entity. In the ER diagram,

the attribute is represented as an oval. There are different types of attributes like

key attribute, composite attribute, multivalued attribute and derived attribute. For

example, a student is an entity and the related attributes for student entity are

student name, student age, student roll number, student address, etc.
The relationship is represented in a diamond shape in the ER diagram. The

relationships exist among entities. There are multiple types of relationships like

one to one, one to many, many to one, and many to many.

4. Relational model
In this data model, the data tables are used to collect a group of elements into the

relations. In this model, the relationships and data are represented using

interrelated tables. And in the table, there are multiple rows and multiple columns

in which column represents the attribute of the entity and the rows are used to

represent records. In this data model there exist different primary key which issued

to distinguish each record in the table. And for retrieving the data elements the

SQL (Structured Query Language) is used. For using the relational data model the

primary key issued as the fundamental tool. And for each entry in the data set, it

needs to be unique. The data table should not contain any type of inconsistency as

it can create a problem at the time of data retrieval. The other problem with the
relational data model is data duplicacy, incomplete data and inappropriate links

used to connect data.

Conclusion
For representing the database there is a different type of data models which are

used for representing database structure. Each data model has its advantage and

disadvantage and the use of a data model is dependent on the use cases.

You might also like