0% found this document useful (0 votes)
103 views36 pages

Bce Unit 5

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)
103 views36 pages

Bce Unit 5

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/ 36

DBMS

DBMS Tutorial provides basic and advanced concepts of Database. Our DBMS Tutorial
is designed for beginners and professionals both.
Database management system is software that is used to manage the database.
Our DBMS Tutorial includes all topics of DBMS such as introduction, ER model, keys,
relational model, join operation, SQL, functional dependency, transaction, concurrency
control, etc.

Database Management System


o Database management system is a software which is used to manage the database.
For example: MySQL, Oracle, etc are a very popular commercial database which
is used in different applications.
o DBMS provides an interface to perform various operations like database creation,
storing data in it, updating data, creating a table in the database and a lot more.
o It provides protection and security to the database. In the case of multiple users, it
also maintains data consistency.

DBMS allows users the following tasks:


o Data Definition: It is used for creation, modification, and removal of definition
that defines the organization of data in the database.
o Data Updation: It is used for the insertion, modification, and deletion of the
actual data in the database.
o Data Retrieval: It is used to retrieve the data from the database which can be used
by applications for various purposes.
o User Administration: It is used for registering and monitoring users, maintain
data integrity, enforcing data security, dealing with concurrency control,
monitoring performance and recovering information corrupted by unexpected
failure.

Characteristics of DBMS
o It uses a digital repository established on a server to store and manage the
information.
o It can provide a clear and logical view of the process that manipulates data.
o DBMS contains automatic backup and recovery procedures.
o It contains ACID properties which maintain data in a healthy state in case of
failure.
o It can reduce the complex relationship between data.
o It is used to support manipulation and processing of data.
o It is used to provide security of data.
o It can view the database from different viewpoints according to the requirements
of the user.

Advantages of DBMS
o Controls database redundancy: It can control data redundancy because it stores
all the data in one single database file and that recorded data is placed in the
database.
o Data sharing: In DBMS, the authorized users of an organization can share the
data among multiple users.
o Easily Maintenance: It can be easily maintainable due to the centralized nature of
the database system.
o Reduce time: It reduces development time and maintenance need.
o Backup: It provides backup and recovery subsystems which create automatic
backup of data from hardware and software failures and restores the data if
required.
o multiple user interface: It provides different types of user interfaces like
graphical user interfaces, application program interfaces

File System:
The file system is basically a way of arranging the files in a storage medium
like a hard disk. The file system organizes the files and helps in the retrieval of
files when they are required. File systems consist of different files which are
grouped into directories. The directories further contain other folders and files.
The file system performs basic operations like management, file naming, giving
access rules, etc.
o Example: NTFS(New Technology File System), EXT(Extended File System).

DBMS(Database Management System) :


Database Management System is basically software that manages the collection of
related data. It is used for storing data and retrieving the data effectively when it is
needed. It also provides proper security measures for protecting the data from
unauthorized access. In Database Management System the data can be fetched by SQL
queries and relational algebra. It also provides mechanisms for data recovery and data
backup.

Example:
Oracle, MySQL, MS SQL server.

Difference between File System and DBMS:


Basis File System DBMS

The file system is software that


DBMS is software for
manages and organizes the files in a
managing the database.
Structure storage medium within a computer.
Basis File System DBMS

Data Redundant data can be present in a In DBMS there is no


Redundancy file system. redundant data.

It provides backup and


It doesn’t provide backup and
Backup and recovery of data even if it is
recovery of data if it is lost.
Recovery lost.

Query There is no efficient query processing Efficient query processing is


processing in the file system. there in DBMS.

There is more data


There is less data consistency in the
consistency because of the
file system.
Consistency process of normalization.

It has more complexity in


It is less complex as compared to
handling as compared to the
DBMS.
Complexity file system.

DBMS has more security


File systems provide less security in
Security mechanisms as compared to
comparison to DBMS.
Constraints file systems.

It has a comparatively higher


It is less expensive than DBMS.
Cost cost than a file system.

Data In DBMS data independence


There is no data independence.
Independence exists.

Only one user can access data at a Multiple users can access
User Access time. data at a time.
Basis File System DBMS

The user has to write procedures for The user not required to write
Meaning managing databases procedures.

Data is distributed in many files. So, Due to centralized nature


Sharing not easy to share data sharing is easy

Data It give details of storage and It hides the internal details of


Abstraction representation of data Database

Integrity Integrity Constraints are difficult to Integrity constraints are easy


Constraints implement to implement

Example Cobol, C++ Oracle, SQL Server

Data Models
Data Model is the modeling of the data description, data semantics, and consistency
constraints of the data. It provides the conceptual tools for describing the design of a
database at each level of data abstraction. Therefore, there are following four data models
used for understanding the structure of the database:

1) Relational Data Model: This type of model designs the data in the form of rows and
columns within a table. Thus, a relational model uses tables for representing data and in-
between relationships. Tables are also called relations. This model was initially described
by Edgar F. Codd, in 1969. The relational data model is the widely used model which is
primarily used by commercial data processing applications.
2) Entity-Relationship Data Model: An ER model is the logical representation of data
as objects and relationships among them. These objects are known as entities, and
relationship is an association among these entities. This model was designed by Peter
Chen and published in 1976 papers. It was widely used in database designing. A set of
attributes describe the entities. For example, student_name, student_id describes the
'student' entity. A set of the same type of entities is known as an 'Entity set', and the set of
the same type of relationships is known as 'relationship set'.

3) Object-based Data Model: An extension of the ER model with notions of functions,


encapsulation, and object identity, as well. This model supports a rich type system that
includes structured and collection types. Thus, in 1980s, various database systems
following the object-oriented approach were developed. Here, the objects are nothing but
the data carrying its properties.

4) Semistructured Data Model: This type of data model is different from the other three
data models (explained above). The semistructured data model allows the data
specifications at places where the individual data items of the same type may have
different attributes sets. The Extensible Markup Language, also known as XML, is
widely used for representing the semistructured data. Although XML was initially
designed for including the markup information to the text document, it gains importance
because of its application in the exchange of data.

5.Hierarchical Model
The hierarchical Model is one of the oldest models in the data model which was
developed by IBM, in the 1950s. In a hierarchical model, data are viewed as a
collection of tables, or we can say segments that form a hierarchical relation. In thi s,
the data is organized into a tree-like structure where each record consists of one parent
record and many children. Even if the segments are connected as a chain-like structure
by logical associations, then the instant structure can be a fan structure with multiple
branches. We call the illogical associations as directional associations.

6. Network Model
The Network Model was formalized by the Database Task group in the 1960s. This
model is the generalization of the hierarchical model. This model can consist of
multiple parent segments and these segments are grouped as levels but there exists a
logical association between the segments belonging to any level. Mostly, there exists a
many-to-many logical association between any of the two segments.

DBMS Architecture
o The DBMS design depends upon its architecture. The basic client/server
architecture is used to deal with a large number of PCs, web servers, database
servers and other components that are connected with networks.
o The client/server architecture consists of many PCs and a workstation which are
connected via the network.
o DBMS architecture depends upon how users are connected to the database to get
their request done.

Types of DBMS Architecture


Database architecture can be seen as a single tier or multi-tier. But logically, database
architecture is of two types like: 2-tier architecture and 3-tier architecture.
1-Tier Architecture
o In this architecture, the database is directly available to the user. It means the user
can directly sit on the DBMS and uses it.
o Any changes done here will directly be done on the database itself. It doesn't
provide a handy tool for end users.
o The 1-Tier architecture is used for development of the local application, where
programmers can directly communicate with the database for the quick response.
2-Tier 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.
o To communicate with the DBMS, client-side application establishes a connection
with the server side.
Fig: 2-tier Architecture

3-Tier Architecture
o The 3-Tier architecture contains another layer between the client and server. In
this architecture, client can't directly communicate with the server.
o The application on the client-end interacts with an application server which further
communicates with the database system.
o End user has no idea about the existence of the database beyond the application
server. The database also has no idea about any other user beyond the application.
o The 3-Tier architecture is used in case of large web application.

Three schema Architecture


o The three schema architecture is also called ANSI/SPARC architecture or three-
level architecture.
o This framework is used to describe the structure of a specific database system.
o The three schema architecture is also used to separate the user applications and
physical database.
o The three schema architecture contains three-levels. It breaks the database down
into three different categories.
The three-schema architecture is as follows:

In the above diagram:


o It shows the DBMS architecture.
o Mapping is used to transform the request and response between various database
levels of architecture.
o Mapping is not good for small DBMS because it takes more time.
o In External / Conceptual mapping, it is necessary to transform the request from
external level to conceptual schema.
o In Conceptual / Internal mapping, DBMS transform the request from the
conceptual to internal level.

Objectives of Three schema Architecture


The main objective of three level architecture is to enable multiple users to access the
same data with a personalized view while storing the underlying data only once. Thus it
separates the user's view from the physical structure of the database. This separation is
desirable for the following reasons:
o Different users need different views of the same data.
o The approach in which a particular user needs to see the data may change over
time.
o The users of the database should not worry about the physical implementation and
internal workings of the database such as data compression and encryption
techniques, hashing, optimization of the internal structures etc.
o All users should be able to access the same data according to their requirements.
o DBA should be able to change the conceptual structure of the database without
affecting the user's
o Internal structure of the database should be unaffected by changes to physical
aspects of the storage.
1. Internal Level
o The internal level has an internal schema which describes the physical storage
structure of the database.
o The internal schema is also known as a physical schema.
o It uses the physical data model. It is used to define that how the data will be stored
in a block.
o The physical level is used to describe complex low-level data structures in detail.
The internal level is generally is concerned with the following activities:
o Storage space allocations.
For Example: B-Trees, Hashing etc.
o Access paths.
For Example: Specification of primary and secondary keys, indexes, pointers and
sequencing.
o Data compression and encryption techniques.
o Optimization of internal structures.
o Representation of stored fields.

2. Conceptual Level
o The conceptual schema describes the design of a database at the conceptual level.
Conceptual level is also known as logical level.
o The conceptual schema describes the structure of the whole database.
o The conceptual level describes what data are to be stored in the database and also
describes what relationship exists among those data.
o In the conceptual level, internal details such as an implementation of the data
structure are hidden.
o Programmers and database administrators work at this level.

3. External Level
o At the external level, a database contains several schemas that sometimes called as
subschema. The subschema is used to describe the different view of the database.
o An external schema is also known as view schema.
o Each view schema describes the database part that a particular user group is
interested and hides the remaining database from that user group.
o The view schema describes the end user interaction with database systems.

Data Independence
o Data independence can be explained using the three-schema architecture.
o 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 types of 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.

Data Dictionary in DBMS


Till now, we learned and understood about relations and its representation. In the
relational database system, it maintains all information of a relation or table, from its
schema to the applied constraints. All the metadata is stored. In general, metadata refers
to the data about data. So, storing the relational schemas and other metadata about the
relations in a structure is known as Data Dictionary or System Catalog.
A data dictionary is like the A-Z dictionary of the relational database system holding all
information of each relation in the database.
The types of information a system must store are:
o Name of the relations
o Name of the attributes of each relation
o Lengths and domains of attributes
o Name and definitions of the views defined on the database
o Various integrity constraints
With this, the system also keeps the following data based on users of the system:
o Name of authorized users
o Accounting and authorization information about users.
o The authentication information for users, such as passwords or other related
information.
In addition to this, the system may also store some statistical and descriptive data
about the relations, such as:
o Number of tuples in each relation
o Method of storage for each relation, such as clustered or non-clustered.
A system may also store the storage organization, whether sequential, hash, or heap.
It also notes the location where each relation is stored:
o If relations are stored in the files of the operating system, the data dictionary note,
and stores the names of the file.
o If the database stores all the relations in a single file, the data dictionary notes and
store the blocks containing records of each relation in a data structure similar to a
linked list.
At last, it also stores the information regarding each index of all the relations:
o Name of the index.
o Name of the relation being indexed.
o Attributes on which the index is defined.
o The type of index formed.

All the above information or metadata is stored in a data dictionary. The data dictionary
also maintains updated information whenever they occur in the relations. Such metadata
constitutes a miniature database. Some systems store the metadata in the form of a
relation in the database itself. The system designers design the way of representation of
the data dictionary. Also, a data dictionary stores the data in a non-formalized manner. It
does not use any normal form so as to fastly access the data stored in the dictionary.

For example, in the data dictionary, it uses underline below the value to represent that
the following field contains a primary key.
A database is a storehouse for a large amount of data, which is used in organizations and
firms. A database management system is a program that helps in updating, accessing,
retrieving, representing, and manipulating the data in a database system.
Database administration involves every activity that is performed by an individual to
ensure that a database is available when needed. Maintaining the integrity of a database is
the primary goal of database administration.
A database administrator carries out several activities and operations to ensure the
integrity, security, and availability of the data stored in the database.

Why do we need a database administrator?


1. A database administrator ensures the security of a database.
2. A database administrator ensures integrity in the database, that is, they make sure
that all the data stored in the database is not misplaced or mismatched.
3. A database administrator works to see if the database is always available and
accessible.
4. A database administrator works with fellow colleagues to plan the future actions
of the organization.

Roles of a database administrator


1. Database backup:
A database administrator has the responsibility to back up every data in the
database, recurrently. This is necessary, so that operations can be restored in times
of disaster or downtime.
2. Database availability:
A database administrator has the responsibility of ensuring database accessibility
to users from time to time.
3. Database restore:
A database administrator has the responsibility of restoring a file from a backup
state, when there is a need for it.
4. Database design:
A database administrator has the responsibility of designing a database that meets
the demands of users. Hence, having knowledge of database design is crucial for
an administrator.
5. Data move:
A database administrator has the responsibility of moving a database set, say from
a physical base to a cloud base, or from an existing application to a new
application.
6. Database upgrade:
A database administrator has the responsibility of upgrading database software
files when there is a new update for them, as this protects software from security
breaches.
7. Database patch:
In times of new upgrades for database software, the database administrator has the
responsibility of ensuring that the database system functions perfectly and works
to close up any gaps in the new update.
8. Database security:
Datasets are assets, and one major responsibility of database administrators is to
protect the data and ensure adequate security in an organization’s database.
9. Capacity planning:
A database administrator has the responsibility of planning for increased capacity,
in case of sudden growth in database need.
10. Database monitoring:
A database administrator has the responsibility of monitoring the database and the
movement of data in the database. Administrators provide access for users who
require access to the database.
11. Error log review:
A database administrator has the responsibility of interpreting the error messages
sent by a database when there is a fault or bridge.
Keys
Keys are one of the basic requirements of a relational database model. It is widely used
to identify the tuples(rows) uniquely in the table. We also use keys to set up relations
amongst various columns and tables of a relational database.

Different Types of Keys in the Relational Model


1. Candidate Key
2. Primary Key
3. Super Key
4. Alternate Key
5. Foreign Key
6. Composite Key

1. Candidate Key: The minimal set of attributes that can uniquely identify a tuple
is known as a candidate key. For Example, STUD_NO in STUDENT relation.
• It is a minimal super key.
• It is a super key with no repeated data is called a candidate key.
• The minimal set of attributes that can uniquely identify a record.
• It must contain unique values.
• It can contain NULL values.
• Every table must have at least a single candidate key.
• A table can have multiple candidate keys but only one primary key (the primary
key cannot have a NULL value, so the candidate key with a NULL value can’t be
the primary key).
• The value of the Candidate Key is unique and may be null for a tuple.
• There can be more than one candidate key in a relationship.

Example:
STUD_NO is the candidate key for relation STUDENT.

Table STUDENT
STUD_NO SNAME ADDRESS PHONE

1 Shyam Delhi 123456789

2 Rakesh Kolkata 223365796

3 Suraj Delhi 175468965


• The candidate key can be simple (having only one attribute) or composite as well.

Example:
{STUD_NO, COURSE_NO} is a composite
candidate key for relation STUDENT_COURSE.

Table STUDENT_COURSE
STUD_NO TEACHER_NO COURSE_NO

1 001 C001

2 056 C005

Note: In SQL Server a unique constraint that has a nullable column, allows the value
‘null‘ in that column only once. That’s why the STUD_PHONE attribute is a
candidate here, but can not be a ‘null’ value in the primary key attribute.

2. Primary Key: There can be more than one candidate key in relation out of
which one can be chosen as the primary key. For Example, STUD_NO, as well as
STUD_PHONE, are candidate keys for relation STUDENT but STUD_NO can be
chosen as the primary key (only one out of many candidate keys).
• It is a unique key.
• It can identify only one tuple (a record) at a time.
• It has no duplicate values, it has unique values.
• It cannot be NULL.
• Primary keys are not necessarily to be a single column; more than one column can
also be a primary key for a table.

Example:
STUDENT table -> Student(STUD_NO, SNAME,
ADDRESS, PHONE) , STUD_NO is a primary key

Table STUDENT
STUD_NO SNAME ADDRESS PHONE

1 Shyam Delhi 123456789

2 Rakesh Kolkata 223365796


STUD_NO SNAME ADDRESS PHONE

3 Suraj Delhi 175468965

3. Super Key: The set of attributes that can uniquely identify a tuple is known as
Super Key. For Example, STUD_NO, (STUD_NO, STUD_NAME), etc. A super key
is a group of single or multiple keys that identifies rows in a table. It supports NULL
values.
• Adding zero or more attributes to the candidate key generates the super key.
• A candidate key is a super key but vice versa is not true.

Example:
Consider the table shown above.
STUD_NO+PHONE is a super key.

4. Alternate Key: The candidate key other than the primary key is called an
alternate key.
• All the keys which are not primary keys are called alternate keys.
• It is a secondary key.
• It contains two or more fields to identify two or more records.
• These values are repeated.
• Eg:- SNAME, and ADDRESS is Alternate keys

Example:
Consider the table shown above.
STUD_NO, as well as PHONE both,
are candidate keys for relation STUDENT but
PHONE will be an alternate key
(only one out of many candidate keys).
5. Foreign Key: If an attribute can only take the values which are present as values
of some other attribute, it will be a foreign key to the attribute to which it refers. The
relation which is being referenced is called referenced relation and the corresponding
attribute is called referenced attribute the relation which refers to the referenced
relation is called referencing relation and the corresponding attribute is called
referencing attribute. The referenced attribute of the referenced relation should be the
primary key to it.
• It is a key it acts as a primary key in one table and it acts as
secondary key in another table.
• It combines two or more relations (tables) at a time.
• They act as a cross-reference between the tables.
• For example, DNO is a primary key in the DEPT table and a non-key in EMP

Example:
Refer Table STUDENT shown above.
STUD_NO in STUDENT_COURSE is a
foreign key to STUD_NO in STUDENT relation.

Table STUDENT_COURSE
STUD_NO TEACHER_NO COURSE_NO

1 005 C001

2 056 C005

It may be worth noting that, unlike the Primary Key of any given relation, Foreign Key
can be NULL as well as may contain duplicate tuples i.e. it need not follow uniqueness
constraint. For Example, STUD_NO in the STUDENT_COURSE relation is not
unique. It has been repeated for the first and third tuples. However, the STUD_NO in
STUDENT relation is a primary key and it needs to be always unique, and it cannot be
null.
6. Composite Key: Sometimes, a table might not have a single column/attribute
that uniquely identifies all the records of a table. To uniquely identify rows of a table, a
combination of two or more columns/attributes can be used. It still can give duplicate
values in rare cases. So, we need to find the optimal set of attributes that can uniquely
identify rows in a table.
• It acts as a primary key if there is no primary key in a table
• Two or more attributes are used together to make a composite key.
• Different combinations of attributes may give different accuracy in terms of
identifying the rows uniquely.

Example:
FULLNAME + DOB can be combined
together to access the details of a student.

SQL Commands
o SQL commands are instructions. It is used to communicate with the database. It is
also used to perform specific tasks, functions, and queries of data.
o SQL can perform various tasks like create a table, add data to tables, drop the
table, modify the table, set permission for users.

Types of SQL Commands


There are five types of SQL commands: DDL, DML, DCL, TCL, and DQL.
1. Data Definition Language (DDL)
o DDL changes the structure of the table like creating a table, deleting a table,
altering a table, etc.
o All the command of DDL are auto-committed that means it permanently save all
the changes in the database.
Here are some commands that come under DDL:
o CREATE
o ALTER
o DROP
o TRUNCATE

a. CREATE It is used to create a new table in the database.


Syntax:
1. CREATE TABLE TABLE_NAME (COLUMN_NAME DATATYPES[,....]);

Example:
1. CREATE TABLE EMPLOYEE(Name VARCHAR2(20), Email VARCHAR2(100), DO
B DATE);

b. DROP: It is used to delete both the structure and record stored in the table.
Syntax
1. DROP TABLE table_name;

Example
1. DROP TABLE EMPLOYEE;

c. ALTER: It is used to alter the structure of the database. This change could be either to
modify the characteristics of an existing attribute or probably to add a new attribute.
Syntax:
To add a new column in the table
1. ALTER TABLE table_name ADD column_name COLUMN-definition;
To modify existing column in the table:
1. ALTER TABLE table_name MODIFY(column_definitions....);

EXAMPLE
1. ALTER TABLE STU_DETAILS ADD(ADDRESS VARCHAR2(20));
2. ALTER TABLE STU_DETAILS MODIFY (NAME VARCHAR2(20));

d. TRUNCATE: It is used to delete all the rows from the table and free the space
containing the table.
Syntax:
1. TRUNCATE TABLE table_name;
Example:
1. TRUNCATE TABLE EMPLOYEE;
2. Data Manipulation Language
o DML commands are used to modify the database. It is responsible for all form of
changes in the database.
o The command of DML is not auto-committed that means it can't permanently save
all the changes in the database. They can be rollback.
Here are some commands that come under DML:
o INSERT
o UPDATE
o DELETE

a. INSERT: The INSERT statement is a SQL query. It is used to insert data into the row
of a table.
Syntax:
1. INSERT INTO TABLE_NAME
2. (col1, col2, col3,.... col N)
3. VALUES (value1, value2, value3, .... valueN);
Or
1. INSERT INTO TABLE_NAME
2. VALUES (value1, value2, value3, .... valueN);

For example:
1. INSERT INTO javatpoint (Author, Subject) VALUES ("Sonoo", "DBMS");
b. UPDATE: This command is used to update or modify the value of a column in the
table.
Syntax:
1. UPDATE table_name SET [column_name1= value1,...column_nameN = valueN] [WHE
RE CONDITION]

For example:
1. UPDATE students
2. SET User_Name = 'Sonoo'
3. WHERE Student_Id = '3'

c. DELETE: It is used to remove one or more row from a table.


Syntax:
1. DELETE FROM table_name [WHERE condition];

For example:
1. DELETE FROM javatpoint
2. WHERE Author="Sonoo";
3. Data Control Language
DCL commands are used to grant and take back authority from any database user.
Here are some commands that come under DCL:
o Grant
o Revoke

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


Example
1. GRANT SELECT, UPDATE ON MY_TABLE TO SOME_USER, ANOTHER_USER;

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

Example
1. REVOKE SELECT, UPDATE ON MY_TABLE FROM USER1, USER2;
4. Transaction Control Language
TCL commands can only use with DML commands like INSERT, DELETE and
UPDATE only.
These operations are automatically committed in the database that's why they cannot be
used while creating tables or dropping them.
Here are some commands that come under TCL:
o COMMIT
o ROLLBACK
o SAVEPOINT

a. Commit: Commit command is used to save all the transactions to the database.
Syntax:
1. COMMIT;

Example:
1. DELETE FROM CUSTOMERS
2. WHERE AGE = 25;
3. COMMIT;

b. Rollback: Rollback command is used to undo transactions that have not already been
saved to the database.

Syntax:
1. ROLLBACK;

Example:
1. DELETE FROM CUSTOMERS
2. WHERE AGE = 25;
3. ROLLBACK;

c. SAVEPOINT: It is used to roll the transaction back to a certain point without rolling
back the entire transaction.

Syntax:
1. SAVEPOINT SAVEPOINT_NAME;
5. Data Query Language
DQL is used to fetch the data from the database.
It uses only one command:
o SELECT

a. SELECT: This is the same as the projection operation of relational algebra. It is used
to select the attribute based on the condition described by WHERE clause.

Syntax:
1. SELECT expressions
2. FROM TABLES
3. WHERE conditions;

For example:
1. SELECT emp_name
2. FROM employee
3. WHERE age > 20;
Cloud Computing
Cloud Computing tutorial provides basic and advanced concepts of Cloud Computing.
Our Cloud Computing tutorial is designed for beginners and professionals.
Cloud computing is a virtualization-based technology that allows us to create, configure,
and customize applications via an internet connection. The cloud technology includes a
development platform, hard disk, software application, and database.
What is Cloud Computing
The term cloud refers to a network or the internet. It is a technology that uses remote
servers on the internet to store, manage, and access data online rather than local drives.
The data can be anything such as files, images, documents, audio, video, and more.
There are the following operations that we can do using cloud computing:
o Developing new applications and services
o Storage, back up, and recovery of data
o Hosting blogs and websites
o Delivery of software on demand
o Analysis of data
o Streaming videos and audios

Why Cloud Computing?


Small as well as large IT companies, follow the traditional methods to provide the IT
infrastructure. That means for any IT company, we need a Server Room that is the

basic need of IT companies.


In that server room, there should be a database server, mail server, networking, firewalls,
routers, modem, switches, QPS (Query Per Second means how much queries or load will
be handled by the server), configurable system, high net speed, and the maintenance
engineers.
To establish such IT infrastructure, we need to spend lots of money. To overcome all
these problems and to reduce the IT infrastructure cost, Cloud Computing comes into
existence.
Characteristics of Cloud Computing
The characteristics of cloud computing are given below:
1) Agility
The cloud works in a distributed computing environment. It shares resources among
users and works very fast.

2) High availability and reliability


The availability of servers is high and more reliable because the chances of
infrastructure failure are minimum.
3) High Scalability
Cloud offers "on-demand" provisioning of resources on a large scale, without having
engineers for peak loads.

4) Multi-Sharing
With the help of cloud computing, multiple users and applications can work more
efficiently with cost reductions by sharing common infrastructure.

5) Device and Location Independence


Cloud computing enables the users to access systems using a web browser regardless of
their location or what device they use e.g. PC, mobile phone, etc. As infrastructure is
off-site (typically provided by a third-party) and accessed via the Internet, users can
connect from anywhere.

6) Maintenance
Maintenance of cloud computing applications is easier, since they do not need to be
installed on each user's computer and can be accessed from different places. So, it
reduces the cost also.

7) Low Cost
By using cloud computing, the cost will be reduced because to take the services of cloud
computing, IT company need not to set its own infrastructure and pay-as-per usage of
resources.

8) Services in the pay-per-use mode


Application Programming Interfaces (APIs) are provided to the users so that they can
access services on the cloud by using these APIs and pay the charges as per the usage
of services.

Cloud infrastructure
Cloud Computing which is one of the demanding technology of current scenario and
which has been proved as a revolutionary technology trend for businesses of all sizes.
It manages a broad and complex infrastructure setup to provide cloud services and
resources to the customers. Cloud Infrastructure which comes under the backend part
of cloud architecture represents the hardware and software component such as server,
storage, networking, management software, deployment software and virtualization
software etc. In backend, cloud infrastructure enables the complete cloud computing
system.
Cloud infrastructure components :
Different components of cloud infrastructure supports the computing requirements of a
cloud computing model. Cloud infrastructure has number of key components but not
limited to only server, software, network and storage devices. Still cloud infrastructure
is categorized into three parts in general i.e.
1. Computing

2. Networking
3. Storage
The most important point is that cloud infrastructure should have some basic
infrastructural constraints like transparency, scalability, security and intelligent
monitoring etc.
The below figure represents components of cloud infrastructure

1. Hypervisor :
Hypervisor is a firmware or a low level program which is a key to enable
virtualization. It is used to divide and allocate cloud resources between several
customers. As it monitors and manages cloud services/resources that’s why hypervisor
is called as VMM (Virtual Machine Monitor) or (Virtual Machine Manager).

2. Management Software :
Management software helps in maintaining and configuring the infrastructure. Cloud
management software monitors and optimizes resources, data, applications and
services.

3. Deployment Software :
Deployment software helps in deploying and integrating the application on the cloud.
So, typically it helps in building a virtual computing environment.

4. Network :
It is one of the key component of cloud infrastructure which is responsible for
connecting cloud services over the internet. For the transmission of data and resources
externally and internally network is must required.

5. Server :
Server which represents the computing portion of the cloud infrastructure is
responsible for managing and delivering cloud services for various services and
partners, maintaining security etc.

6. Storage :
Storage represents the storage facility which is provided to different organizations for
storing and managing data. It provides a facility of extracting another resource if one
of the resource fails as it keeps many copies of storage.
Along with this, virtualization is also considered as one of important component of
cloud infrastructure. Because it abstracts the available data storage and computing
power away from the actual hardware and the users interact with their cloud
infrastructure through GUI (Graphical User Interface).

Cloud Service Models


Cloud Computing can be defined as the practice of using a network of remote servers
hosted on the Internet to store, manage, and process data, rather than a local server or a
personal computer. Companies offering such kinds of cloud computing services are
called cloud providers and typically charge for cloud computing services based on
usage. Grids and clusters are the foundations for cloud computing.
There are the following three types of cloud service models –
1. Infrastructure as a Service (IaaS)
2. Platform as a Service (PaaS)
3. Software as a Service (SaaS)

Infrastructure as a Service (IaaS)


IaaS is also known as Hardware as a Service (HaaS). It is a computing infrastructure
managed over the internet. The main advantage of using IaaS is that it helps users to
avoid the cost and complexity of purchasing and managing the physical servers.
Characteristics of IaaS
There are the following characteristics of IaaS -
o Resources are available as a service
o Services are highly scalable
o Dynamic and flexible
o GUI and API-based access
o Automated administrative tasks

Example: DigitalOcean, Linode, Amazon Web Services (AWS), Microsoft Azure,


Google Compute Engine (GCE), Rackspace, and Cisco Metacloud.
To know more about the IaaS, click here.

Platform as a Service (PaaS)


PaaS cloud computing platform is created for the programmer to develop, test, run, and
manage the applications.
Characteristics of PaaS
There are the following characteristics of PaaS -
o Accessible to various users via the same development application.
o Integrates with web services and databases.
o Builds on virtualization technology, so resources can easily be scaled up or down
as per the organization's need.
o Support multiple languages and frameworks.
o Provides an ability to "Auto-scale".

Example: AWS Elastic Beanstalk, Windows Azure, Heroku, Force.com, Google App
Engine, Apache Stratos, Magento Commerce Cloud, and OpenShift.
To know more about PaaS, click here.

Software as a Service (SaaS)


SaaS is also known as "on-demand software". It is a software in which the applications
are hosted by a cloud service provider. Users can access these applications with the help
of internet connection and web browser.
Characteristics of SaaS
There are the following characteristics of SaaS -
o Managed from a central location
o Hosted on a remote server
o Accessible over the internet
o Users are not responsible for hardware and software updates. Updates are applied
automatically.
o The services are purchased on the pay-as-per-use basis

Example: BigCommerce, Google Apps, Salesforce, Dropbox, ZenDesk, Cisco WebEx,


ZenDesk, Slack, and GoToMeeting.
Difference between IaaS, PaaS, and SaaS
The below table shows the difference between IaaS, PaaS, and SaaS -

IaaS Paas SaaS

It provides a virtual data It provides virtual platforms It provides web software


center to store and tools to create, test, and and apps to complete
information and create deploy apps. business tasks.
platforms for app
development, testing, and
deployment.

It provides access to It provides runtime It provides software as a


resources such as virtual environments and service to the end-users.
machines, virtual storage, deployment tools for
etc. applications.

It is used by network It is used by developers. It is used by end users.


architects.

IaaS provides only PaaS provides SaaS provides


Infrastructure. Infrastructure+Platform. Infrastructure+Platform
+Software.

In cloud computing, we have access to a shared pool of computer resources (servers,


storage, programs, and so on) in the cloud. You simply need to request additional
resources when you require them. Getting resources up and running quickly is a breeze
thanks to the clouds. It is possible to release resources that are no longer necessary.
This method allows you to just pay for what you use. Your cloud provider is in charge
of all upkeep.

Types of Cloud Computing Deployment Models


The cloud deployment model identifies the specific type of cloud environment based on
ownership, scale, and access, as well as the cloud’s nature and purpose. The location of
the servers you’re utilizing and who controls them are defined by a cloud deployment
model. It specifies how your cloud infrastructure will look, what you can change, and
whether you will be given services or will have to create everything yourself.
Relationships between the infrastructure and your users are also defined by cloud
deployment types. Different types of cloud computing deployment models are described
below.

• Public Cloud
• Private Cloud
• Hybrid Cloud
• Community Cloud

Public Cloud
The public cloud makes it possible for anybody to access systems and services. The
public cloud may be less secure as it is open to everyone. The public cloud is one in
which cloud infrastructure services are provided over the internet to the general people
or major industry groups. The infrastructure in this cloud model is owned by the entity
that delivers the cloud services, not by the consumer. It is a type of cloud hosting that
allows customers and users to easily access systems and services. This form of cloud
computing is an excellent example of cloud hosting, in which service providers supply
services to a variety of customers. In this arrangement, storage backup and retrieval
services are given for free, as a subscription, or on a per-user basis. For example,
Google App Engine etc.

Advantages of the Public Cloud Model


• Minimal Investment: Because it is a pay-per-use service, there is no substantial
upfront fee, making it excellent for enterprises that require immediate access to
resources.
• No setup cost: The entire infrastructure is fully subsidized by the cloud service
providers, thus there is no need to set up any hardware.
• Infrastructure Management is not required: Using the public cloud does not
necessitate infrastructure management.
• No maintenance: The maintenance work is done by the service provider (not users).
• Dynamic Scalability: To fulfill your company’s needs, on-demand resources are
accessible.

Disadvantages of the Public Cloud Model


• Less secure: Public cloud is less secure as resources are public so there is no
guarantee of high-level security.
• Low customization: It is accessed by many public so it can’t be customized
according to personal requirements.

Private Cloud
The private cloud deployment model is the exact opposite of the public cloud
deployment model. It’s a one-on-one environment for a single user (customer). There is
no need to share your hardware with anyone else. The distinction between private and
public clouds is in how you handle all of the hardware. It is also called the “internal
cloud” & it refers to the ability to access systems and services within a given border or
organization. The cloud platform is implemented in a cloud-based secure environment
that is protected by powerful firewalls and under the supervision of an organization’s IT
department. The private cloud gives greater flexibility of control over cloud resources.

Advantages of the Private Cloud Model


• Better Control: You are the sole owner of the property. You gain complete
command over service integration, IT operations, policies, and user behavior.
• Data Security and Privacy: It’s suitable for storing corporate information to which
only authorized staff have access. By segmenting resources within the same
infrastructure, improved access and security can be achieved.
• Supports Legacy Systems: This approach is designed to work with legacy systems
that are unable to access the public cloud.
• Customization: Unlike a public cloud deployment, a private cloud allows a
company to tailor its solution to meet its specific needs.

Disadvantages of the Private Cloud Model


• Less scalable: Private clouds are scaled within a certain range as there is less
number of clients.
• Costly: Private clouds are more costly as they provide personalized facilities.
Hybrid Cloud
By bridging the public and private worlds with a layer of proprietary software, hybrid
cloud computing gives the best of both worlds. With a hybrid solution, you may host
the app in a safe environment while taking advantage of the public cloud’s cost savings.
Organizations can move data and applications between different clouds using a
combination of two or more cloud deployment methods, depending on their needs.

Advantages of the Hybrid Cloud Model


• Flexibility and control: Businesses with more flexibility can design personalized
solutions that meet their particular needs.
• Cost: Because public clouds provide scalability, you’ll only be responsible for
paying for the extra capacity if you require it.
• Security: Because data is properly separated, the chances of data theft by attackers
are considerably reduced.

Disadvantages of the Hybrid Cloud Model


• Difficult to manage: Hybrid clouds are difficult to manage as it is a combination of
both public and private cloud. So, it is complex.
• Slow data transmission: Data transmission in the hybrid cloud takes place through
the public cloud so latency occurs.

Community Cloud
It allows systems and services to be accessible by a group of organizations. It is a
distributed system that is created by integrating the services of different clouds to
address the specific needs of a community, industry, or business. The infrastructure of
the community could be shared between the organization which has shared concerns or
tasks. It is generally managed by a third party or by the combination of one or more
organizations in the community.
Advantages of the Community Cloud Model
• Cost Effective: It is cost-effective because the cloud is shared by multiple
organizations or communities.
• Security: Community cloud provides better security.
• Shared resources: It allows you to share resources, infrastructure, etc. with
multiple organizations.
• Collaboration and data sharing: It is suitable for both collaboration and data
sharing.

Disadvantages of the Community Cloud Model


• Limited Scalability: Community cloud is relatively less scalable as many
organizations share the same resources according to their collaborative interests.
• Rigid in customization: As the data and resources are shared among different
organizations according to their mutual interests if an organization wants some
changes according to their needs they cannot do so because it will have an impact on
other organizations.

Advantages and Disadvantages of Cloud Computing


Advantages of Cloud Computing
As we all know that Cloud computing is trending technology. Almost every company
switched their services on the cloud to rise the company growth.
Here, we are going to discuss some important advantages of Cloud Computing-
1) Back-up and restore data
Once the data is stored in the cloud, it is easier to get back-up and restore that data using
the cloud.

2) Improved collaboration
Cloud applications improve collaboration by allowing groups of people to quickly and
easily share information in the cloud via shared storage.
3) Excellent accessibility
Cloud allows us to quickly and easily access store information anywhere, anytime in the
whole world, using an internet connection. An internet cloud infrastructure increases
organization productivity and efficiency by ensuring that our data is always accessible.

4) Low maintenance cost


Cloud computing reduces both hardware and software maintenance costs for
organizations.

5) Mobility
Cloud computing allows us to easily access all cloud data via mobile.

6) IServices in the pay-per-use model


Cloud computing offers Application Programming Interfaces (APIs) to the users for
access services on the cloud and pays the charges as per the usage of service.

7) Unlimited storage capacity


Cloud offers us a huge amount of storing capacity for storing our important data such as
documents, images, audio, video, etc. in one place.

8) Data security
Data security is one of the biggest advantages of cloud computing. Cloud offers many
advanced features related to security and ensures that data is securely stored and handled.

Disadvantages of Cloud Computing


A list of the disadvantage of cloud computing is given below -

1) Internet Connectivity
As you know, in cloud computing, every data (image, audio, video, etc.) is stored on the
cloud, and we access these data through the cloud by using the internet connection. If you
do not have good internet connectivity, you cannot access these data. However, we have
no any other way to access data from the cloud.

2) Vendor lock-in
Vendor lock-in is the biggest disadvantage of cloud computing. Organizations may face
problems when transferring their services from one vendor to another. As different
vendors provide different platforms, that can cause difficulty moving from one cloud to
another.
3) Limited Control
As we know, cloud infrastructure is completely owned, managed, and monitored by the
service provider, so the cloud users have less control over the function and execution of
services within a cloud infrastructure.

4) Security
Although cloud service providers implement the best security standards to store
important information. But, before adopting cloud technology, you should be aware that
you will be sending all your organization's sensitive information to a third party, i.e., a
cloud computing service provider. While sending the data on the cloud, there may be a
chance that your organization's information is hacked by Hackers.

You might also like